Caching · Request & Response
Cache-Control
Directives that control caching behavior.
What is Cache-Control?
Cache-Control is the primary way to instruct browsers and CDN caches how, and how long, a response can be reused. It supersedes older headers like Expires and Pragma.
Typical usage
Set on almost every response. Static assets get long max-age + immutable; HTML gets short max-age or no-store; sensitive responses get no-store.
Examples
Static asset, cache forever
Cache-Control: public, max-age=31536000, immutableHTML, revalidate every time
Cache-Control: no-cachePrivate data, never store
Cache-Control: no-storeCDN caches 1 hour, browsers 1 min
Cache-Control: public, s-maxage=3600, max-age=60Common gotchas
no-cache does NOT mean 'don't cache' — it means 'cache, but revalidate every time'. Use no-store if you want zero caching. Confusing these two is one of the top HTTP mistakes.
Specification
RFC 9111