Cache-Control general-header field is used to specify directives for caching mechanisms in both requests and responses. Caching directives are unidirectional, meaning that a given directive in a request is not implying that the same directive is to be given in the response.
The directives are case-insensitive and have an optional argument, that can use both token and quoted-string syntax. Multiple directives are comma-separated.
Cache-Control directives that can be used by the client in an HTTP request.
Cache-Control: max-age=<seconds> Cache-Control: max-stale[=<seconds>] Cache-Control: min-fresh=<seconds> Cache-Control: no-cache Cache-Control: no-store Cache-Control: no-transform Cache-Control: only-if-cached
Cache-Control directives that can be used by the server in an HTTP response.
Cache-Control: must-revalidate Cache-Control: no-cache Cache-Control: no-store Cache-Control: no-transform Cache-Control: public Cache-Control: private Cache-Control: proxy-revalidate Cache-Control: max-age=<seconds> Cache-Control: s-maxage=<seconds>
Cache-Control directives are not part of the core HTTP caching standards document. Be sure to check the compatibility table for their support.
Cache-Control: immutable Cache-Control: stale-while-revalidate=<seconds> Cache-Control: stale-if-error=<seconds>
Expires, this directive is relative to the time of the request.
Expiresheader, but it only applies to shared caches (e.g., proxies) and is ignored by a private cache.
must-revalidate, but it only applies to shared caches (e.g., proxies) and is ignored by a private cache.
If-Modified-Since) to check for updates, even when the user explicitly refreshes the page. Clients that aren't aware of this extension must ignore them as per the HTTP specification. In Firefox,
immutableis only honored on
https://transactions. For more information, see also this blog post.
no-transformdirective disallows this.
To turn off caching, you can send the following response header. In addition, see also the
Cache-Control: no-cache, no-store, must-revalidate
Cache-Control: public, max-age=31536000
|RFC 7234||Hypertext Transfer Protocol (HTTP/1.1): Caching|
|RFC 5861||HTTP Cache-Control Extensions for Stale Content|
|RFC 8246||HTTP Immutable Responses|
|Feature||Android webview||Chrome for Android||Edge mobile||Firefox for Android||IE mobile||Opera Android||iOS Safari|
1. See Chromium bug 348877.
2. See Bugzilla bug 995651.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.