Give different responses different policies. Static assets, public HTML, and private account data do not share the same caching requirements.
Versioned static assets
Cache-Control: public, max-age=31536000, immutable
Use a long lifetime when the asset receives a new URL whenever its contents change, such as a hashed stylesheet filename. The HTML referencing it needs a separate policy so it can discover updated asset URLs.
HTML and private data
Public HTML can use a short freshness lifetime, or no-cache if every reuse should check with the server. Pair validation with a correct ETag or Last-Modified value where the application can provide one.
Use private, no-cache when browser storage is acceptable but shared caching is not. Use no-store for sensitive responses that should not enter HTTP caches. Do not rely on the presence of a session cookie to keep personalized HTML out of a CDN.
CDN and proxy caching
# Only for an intentionally public response:
Cache-Control: public, max-age=60, s-maxage=300
This allows a one-minute browser lifetime and a five-minute shared-cache lifetime. CDN rules, cache eligibility, and cache-key settings can change the result. Verify the actual behavior instead of assuming the header is the only control.
Check variants and updates
Use Vary for relevant request-header differences, such as Accept-Encoding or a dynamically selected CORS origin. Excessive variants reduce cache efficiency. A CDN's custom cache key may require additional configuration.
Compare logged-out and logged-in responses, several paths, and fresh versus repeated requests. A new policy will not immediately reach a cache still serving an old fresh object: purge where necessary, then verify. See stale content troubleshooting.