To catch a leaking cache, pretend to be three people
transcript
A CDN just served one shopper's cart to 47 strangers. How do you catch that before customers do? Become three people.
The bug started with one rule: cache everything under slash api. So first, classify every path. Images, styles, scripts? Public. Cached for 24 hours. Products and search? Public, for 5 minutes. User, cart and orders? Never cached. They bypass the CDN.
But here's the catch. Last time, the backend's headers were already right. The CDN ignored them. So verify what the edge actually returns.
Ask the same endpoint as three different users. Through the CDN. All three answers different? Each user got their own data. Not all different? That's poisoning. Purge at once. Run it every 30 seconds. In production.
One more alarm. How often should a cart come from cache? Never. Zero. So if user endpoints show over 10 percent cache hits, alert.
The deepest fix wasn't technical. DevOps tuned the CDN for speed. Security reviewed the application. The layer that leaked sat between them. Now CDN changes need security approval. And cache config gets peer review, like code.
Next time you add max-age 300, ask one question. Whose data am I caching? And who might see it?
Full breakdown in the lecture.