Close

Cache-Control Header

[Last Updated: Nov 16, 2026]

HTTP Web 

Cache-Control is an HTTP header used to specify caching policies in both requests and responses. It tells browsers and intermediate caches (proxies, CDNs) whether a response can be stored, who can store it, and for how long.
Caching avoids repeated downloads of the same resource, which reduces latency and server load. For example, the server can tell the client to reuse a response for 10 minutes:
Cache-Control: max-age=600

max-age=n sets the maximum time, in seconds, that the response is considered fresh, counted from the moment it was generated. During this time a cache can serve the stored response without contacting the origin server. Once it has expired, the response becomes stale and must be revalidated or fetched again.
Multiple directives can be combined, separated by commas:
Cache-Control: public, max-age=86400

Commonly used response directives:
  • max-age=n: response is fresh for n seconds.
  • s-maxage=n: same as max-age but applies only to shared caches (proxies, CDNs) and overrides max-age for them.
  • public: response may be stored by any cache, including shared caches.
  • private: response is intended for a single user and must not be stored by shared caches (browser cache only).
  • no-cache: response may be stored, but must be revalidated with the origin server before each reuse.
  • no-store: response must not be stored in any cache at all (e.g. sensitive data).
  • must-revalidate: once stale, the cache must not reuse the response without successful revalidation.
  • immutable: response will not change while fresh, so the browser should not revalidate even on reload.
Clients can also send Cache-Control in a request, for example to force a fresh copy:
Cache-Control: no-cache

A typical example for a versioned static file (e.g. app.3f9a1c.js) that never changes, cached for one year:
Cache-Control: public, max-age=31536000, immutable

And for a dynamic page with user-specific content that should always be validated:
Cache-Control: private, no-cache

Cache-Control supersedes the older HTTP/1.0 headers Expires and Pragma. If both max-age and Expires are present, max-age takes precedence.

Reference:
RFC 9111 - HTTP Caching
Join