A logo, today’s opening hours and a customer invoice can leave the same web server. Giving all three the same cache policy forces a choice between stale public information, slow assets and exposed personal data. Give each response an explicit owner and lifetime.
Assets that change names
A versioned file can carry a long freshness lifetime when each content change produces a new URL. Keep the old file available for pages still referring to that release. Reusing the old filename breaks that contract because browsers may continue using the earlier bytes after an edge purge.
Public pages that change in place
Suppose opening hours may remain at the edge for five minutes but browsers should check before reuse. The example gives a shared cache that separate lifetime. On expiry an ETag can let a cache validate the representation without retrieving an unchanged body. Verify that your distribution honors the origin’s headers.
Cache-Control: public, max-age=0, s-maxage=300
ETag: "opening-hours-v7"Account pages and private documents
Use a shared-cache bypass for account routes. The private directive restricts storage to private caches, while no-store instructs caches to avoid storing the response. The no-cache directive permits storage but requires validation before reuse. For a sensitive invoice, apply the intended policy to the actual response and test it through the public delivery hostname.
Sources & further reading
Reader questions
Will adding no-store remove a previously cached response?
A new directive cannot reach a cache that is still serving an old fresh entry. Correct the policy, invalidate affected shared entries, and account for any existing browser copies.
