Cache-Control
The HTTP header directing how a response may be cached and for how long, by browsers, proxies and CDNs.
The directives worth knowing precisely, because their combinations decide CDN behaviour:
max-age — seconds a response is fresh. s-maxage — the same for shared caches only, letting
a CDN cache longer than a browser. public / private — whether shared caches may store it at
all; personalised responses must be private.
no-cache means revalidate before use, not "do not store" — a common misreading. no-store is
the one that forbids storage.
stale-while-revalidate serves a stale response immediately while refreshing in the background —
the single most useful directive for availability, since it removes the latency of a refresh and keeps
serving if the origin is down.
immutable tells browsers not to revalidate on reload, which is correct for content-hashed assets.
The pattern that works: content-hashed filenames with a long max-age and immutable; HTML with a
short max-age and stale-while-revalidate.