How would you detect a cache that serves stale or private data incorrectly?
Answer
Vary users, authorization, query parameters and freshness conditions; inspect cache headers and validators; update the origin and verify invalidation. Test shared caches for cross-user leakage and browser caches for offline or back-navigation behaviour.
Strong answer includes
- freshness and validators
- invalidation
- private-data isolation
Practical example
A tester logs in as User A, loads a page showing account balance, then logs out and logs in as User B on the same browser tab within the CDN's cache window, and discovers User B briefly sees User A's cached balance — a critical shared-cache leak traced back to a missing Vary: Authorization header.