tools / HTTP reference / cache-control header explained
HTTP · RFC 7234 §5.2 (Cache-Control)

Cache-Control header

Cache-Control governs how responses are cached by browsers, CDNs, and reverse proxies. Misconfigured = users get stale data, OR cache hit rate drops to 0.

advanced RFC 7234 §5.2 (Cache-Control)

What the RFC says

The 'Cache-Control' header field is used to specify directives for caches along the request/response chain. Such cache directives are unidirectional in that the presence of a directive in a request does not imply that the same directive is to be given in the response. (RFC 7234 §5.2) — RFC 7234 §5.2 (Cache-Control)

Example

Cache-Control: public, max-age=31536000, immutable
# 1 year, browser+CDN, content guaranteed unchanged

Cache-Control: private, max-age=0, must-revalidate
# user-specific, always revalidate before serving

Cache-Control: no-store
# never cache (sensitive data)

Cache-Control: s-maxage=3600, max-age=60
# CDN: 1h, browser: 1min

Real-world implementations

Common misuses (don't do this)

Use cases

Get the RFC reference for any HTTP response
httpwut takes a curl response and explains the status code + headers + the RFC sections you should actually read. Built for HTTP debugging that goes deeper than 'lol 500'.
Open httpwut  

Related HTTP topics

429 too many requests (rate limiting) · 429 too many requests (rate limiting) · 429 too many requests (rate limiting) · 429 too many requests (rate limiting)