Scrivio Interview library
DebuggingIntermediate7 min read · updated 13 November 2026

After a CDN configuration change meant to speed up the website, a few users report that the account page shows another person's name and order history. Origin responses for /account carry no Cache-Control header, and the new CDN rule caches all HTML for 60 seconds.

What went wrong, what do you do in the first hour, and how do you make sure personalised responses can never be cached at the edge again?

The new CDN rule stored the /account HTML of whichever user asked first and served that copy to everyone who requested /account in the next 60 seconds, because the cache key was only the URL and the origin never said the page must not be cached. In the first hour we roll the rule back, purge the cached pages and treat it as a data exposure incident. To stop it happening again, personalised responses send Cache-Control: private, no-store, the CDN honours origin headers and refuses to store anything tied to a session, and an automated two-user test guards every CDN change.

Why this question is asked

A CDN leak of personal data is one of the worst caching failures there is, because it is not a slow page or a stale price but a privacy breach, and it usually comes from a change that looked like a harmless performance tweak. Interviewers ask it to see whether we understand how a shared cache decides what to store, act in the right order during an incident, and fix the system rather than one rule. In this answer, we will explain exactly how one user's page reached another user, walk through the first hour of the response, and then build the defences in three places: the origin's headers, the CDN's configuration and an automated test that catches the mistake before it ships.

1A Quick Recap of How a CDN Cache Decides

A CDN is a network of edge servers placed close to users, sitting between the browser and our origin, the application servers that render pages. For each request the edge computes a cache key, by default the host and path. If it holds a fresh response under that key, it returns it without asking the origin; if not, it forwards the request and stores the response if it is allowed to.

Whether it may store a response depends on two things: the origin's Cache-Control header, which can say no-store (never keep this), private (only the user's own browser may keep this) or public with a lifetime, and the CDN's own rules, which can override or fill in what the origin did not say. A missing header is not a ban. Without Cache-Control, a cache may apply its own policy, and our new rule told it to keep all HTML for 60 seconds.

2Reproducing the Leak Step by Step

Here is the sequence that produced the incident. Alice opens /account. Her browser sends her session cookie, the edge has nothing stored for /account, so it forwards the request. The origin reads the cookie, renders a page with Alice's name and orders, and sends it back with no Cache-Control header. The new rule says HTML may be cached for 60 seconds, so the edge stores the page under the key /account.

Ten seconds later Bob opens /account from the same region. His request carries his own cookie, but the cache key does not include cookies, so the edge finds a fresh entry under /account and returns Alice's page. The origin never sees Bob's request, so it never gets the chance to check who he is. Only a few users saw it because each edge location has its own cache and each entry lives just 60 seconds.

Step throughHow Bob received Alice's page
AliceBobCDN edgeOrigin
GET /account (Alice's cookie)
miss: forward request
Alice's page, no Cache-Control
rule: cache HTML 60 s under /account
Alice's page
GET /account (Bob's cookie)
hit: Alice's page

7 messages in order. Play them, or step through them one at a time.

The cache key ignores the cookie, so Bob's request matches the entry made from Alice's request.

3The First Hour: Stop, Purge, Investigate

The first action is to stop the bleeding: roll back the CDN rule through the pipeline that deployed it, then purge /account and every other personalised path, because a rollback stops new entries but does not remove stored ones. We confirm with two test users that those pages are now always misses.

Next, we treat this as a security incident and not only as a bug. We open an incident, bring in the security and privacy teams early, and preserve evidence. The CDN's request logs tell us, per edge location, which requests to /account were served as hits during the exposure window, which client addresses and session identifiers received them, and which origin response populated each entry. That lets us build a list of users whose data was shown and users who saw it. Privacy colleagues decide on notification duties, which often have legal deadlines.

There is one more risk to check. If the origin's response also carried a Set-Cookie header, for example a refreshed session cookie, the cached copy handed Alice's session to Bob, and Bob is now effectively logged in as Alice. So we look at whether cached responses included Set-Cookie, and if there is any doubt we invalidate all sessions issued during the window and force those users to log in again.

Step throughThe first hour of the incident
  1. Roll back the CDN rulethrough the normal deploy pipeline
  2. Purge /account and personalised pathsa rollback does not remove stored entries
  3. Verify as two test userscache status shows a miss every time
  4. Open a security incidentinvolve security and privacy, keep the logs
  5. Did cached responses carry Set-Cookie?
    YesInvalidate sessions from the windowNoKeep sessions, continue
  6. Build the affected-user list from CDN logswho saw data and whose data was seen

6 steps in order. Play them, or step through them one at a time.

4Fix 1: Make the Origin Say What It Means

The lasting fix starts at the origin, because the origin is the only place that knows a page is personal. Every response that depends on who the user is should say so explicitly. In Spring we can do this per controller, or once for all authenticated routes in a filter or interceptor.

Java
@GetMapping("/account")
ResponseEntity<String> account(Principal user) {
String html = renderAccountPage(user);
return ResponseEntity.ok()
.cacheControl(CacheControl.noStore().cachePrivate()) // Cache-Control: no-store, private
.body(html);
}
// Spring Security already adds no-cache, no-store, max-age=0, must-revalidate
// to responses by default unless the application turns its cache headers off.

Notice the comment. Spring Security writes conservative cache headers by default, so a missing header on /account means someone disabled that default or the route bypasses the filter chain. And because a CDN rule can override origin headers, the CDN must also be told to honour them, never overriding them for anything personal.

5Fix 2: Make the CDN Defensive by Default

We configure the CDN so that a mistake at the origin cannot leak data. It should never store a response that carries Set-Cookie, never store a response to a request that carried a session cookie or an Authorization header, and cache only paths that are on an explicit allow list, such as /static, /images and the public marketing pages. Everything else is passed through to the origin untouched.

The allow list matters most. A rule that caches all HTML assumes every page is public unless someone excludes it; an allow list flips that, so a personalised page added next year is safe by default.

Layers of protection after the fix
LayerRuleWhat it catches
OriginPersonal pages send private, no-storeThe page itself declares it is personal
CDNHonour origin Cache-Control on all pathsA rule cannot silently override the origin
CDNDo not store responses with Set-CookieSession cookies handed to other users
CDNBypass when request has session cookie or AuthorizationPages the origin forgot to mark
CDNCache only allow-listed pathsNew pages added without thinking about caching
PipelineTwo-user test through the CDN in stagingA bad rule before it reaches production

6Fix 3: Test Rule Changes Like Code

Finally, we stop treating CDN configuration as settings clicked in a console. Rules live in a repository, changes go through review by someone who knows the caching model, and the deploy pipeline runs an automated check in staging. The check logs in as two different test users, requests every personalised page through the staging CDN, and fails if the second user ever receives content containing the first user's name or identifier, or if the cache status ever reports a hit for those paths.

7Follow-up questions

What would you tell affected users?

We would tell them plainly what happened, when, and what was exposed: for a stated window of a few minutes, a caching mistake caused some account pages to be shown to other visitors, and their name and order history may have been seen by another customer. We say what we have done, which is fixing the configuration, removing the cached pages and resetting sessions if that applied, and whether they need to do anything, such as logging in again. We would not speculate or minimise, and the wording and timing would be agreed with the privacy and legal teams, because some regulations require notifying a regulator and the individuals within fixed deadlines.

Why not just add the session cookie to the cache key?

Because it only looks safe. Each user then gets their own cache entry, so the hit ratio for those pages drops to almost nothing, while we still store personal data on shared edge servers and rely on the key being built correctly forever. If a page is personal, the right answer is not to cache it at the edge at all, or to split it into a cacheable shared shell and a separate personal API call.

8Conclusion

In this answer, we saw how a rule that cached all HTML, combined with an origin that sent no Cache-Control, made the CDN serve one user's account page to others under the bare URL. In the first hour we roll back, purge, verify with two test users and run a data exposure incident, invalidating sessions if cached responses carried Set-Cookie. The lasting fix is private, no-store at the origin, a CDN that honours it, bypasses anything tied to a session and caches only allow-listed paths, and a two-user test on every CDN change.

What to say in the interviewAbout 80 seconds aloud

Open with

The cause is that the CDN cache key was just the URL and the origin sent no Cache-Control on /account, so when the new rule cached all HTML for 60 seconds, the edge stored the first user's account page and served it to anyone else on that edge within the minute.

Then, if they want more

First, I roll the rule back, purge /account and other personalised paths, and confirm with two test users that those pages are always misses. At the same time I open a security incident with security and privacy, and use the CDN logs to work out whose page was cached and who received it.

If cached responses carried Set-Cookie, other users may hold someone's session, so I would invalidate sessions from that window. The permanent fix has three layers. The origin marks personalised responses private, no-store, and I would find out why Spring Security's default headers were missing.

The CDN honours origin headers, never stores responses with Set-Cookie or answers to requests with a session cookie or Authorization, and caches only an allow list of public paths. And CDN rules live in a repository with review and a staging test that logs in as two users and fails if one sees the other's data.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "What went wrong, what do you do in the first hour, and how do you make sure personalised...": https://scrivio-interview-library.netlify.app/architecture/caching-strategies/f4efbb048d/