Cache-Control is an HTTP header that tells browsers and shared caches such as CDNs whether and for how long they may store a response. It can appear in responses and in requests. Directives are separated by commas and are case-insensitive.
Which directives are important?
| Directive | Meaning |
|---|---|
max-age=N |
The response stays fresh for N seconds after it was generated. |
s-maxage=N |
Same as max-age, but only for shared caches such as CDNs. |
no-cache |
The response may be stored, but must be revalidated with the server before each reuse. |
no-store |
The response must not be stored in any cache. |
private |
Only a private cache, such as the browser, may store it. |
public |
Shared caches may store it, even for requests with authorization. |
must-revalidate |
After it becomes stale, the response must be revalidated before reuse. |
immutable |
The response will not change while fresh, so no revalidation is needed. |
stale-while-revalidate=N |
A stale response may be served for N seconds while a fresh copy is fetched in the background. |
What is the difference between no-cache and no-store?
The names are easy to mix up. no-cache allows storing and requires a check with the server before reuse, which often results in a 304 Not Modified. no-store forbids storing. According to RFC 9111, no-store is not a reliable mechanism for privacy, since it relies on caches behaving as specified.
Common patterns
- Versioned static files:
Cache-Control: max-age=31536000, immutable - HTML pages that should always be checked:
Cache-Control: no-cache - Personalized content:
Cache-Control: private - Content for a CDN:
Cache-Control: public, s-maxage=3600
Example
HTTP/1.1 200 OK
Cache-Control: public, max-age=604800
ETag: "33a64df5"
Cache-Control and crawlers
Google’s crawlers support ETag and Last-Modified for conditional requests. Setting a validator together with Cache-Control lets repeated requests end in 304 Not Modified. Google writes that max-age is not required, but worth considering as an addition so crawlers can tell when to recrawl a URL. Other HTTP caching directives are not supported by Google.
| Header / status | Request counterpart | What it does | Relevance for Google's crawlers |
|---|---|---|---|
Cache-Control (this term) | – (directives can also appear in requests) | lists directives for caches, e.g. max-age (fresh for N seconds), no-cache (reuse only after revalidation), no-store (do not store) | max-age is optional and helps crawlers decide when to recrawl the URL; Google does not support other caching directives |
ETag | If-None-Match | identifier for the current version of a resource | supported and recommended by Google because it has no date formatting issues; takes precedence when both validators are present |
Last-Modified | If-Modified-Since | date and time at which the server believes the resource was last modified | supported; the date must follow the HTTP format, e.g. Fri, 4 Sep 1998 19:15:56 GMT |
304 Not Modified | response to a conditional GET or HEAD request | signals that the stored copy is still valid; the response has no body | the crawler tells the next system that the content is the same as at the last crawl; Search may recalculate signals, otherwise no effect on indexing |
Google suggests setting both ETag and Last-Modified, since other applications use them too. Whether a Google crawler uses caching depends on its product: Googlebot uses it when recrawling URLs for Google Search. According to Google's December 2024 blog post, only 0.017% of all fetches could be served from cache. Sources: Google Crawling Infrastructure: Overview of Google crawlers and fetchers, HTTP caching (last updated 2026-06-12); Google Search Central Blog: Crawling December: HTTP caching (2024-12-09); Google Crawling Infrastructure: HTTP status codes, network and DNS errors (last updated 2026-02-04); MDN: HTTP caching; RFC 9111: HTTP Caching; RFC 9110: HTTP Semantics (8.8.2 Last-Modified, 8.8.3 ETag, 15.4.5 304). Last checked: .
Sources
- Cache-Control – MDN Web Docsdeveloper.mozilla.org
- HTTP Caching, RFC 9111rfc-editor.org
- HTTP caching – MDN Web Docsdeveloper.mozilla.org
- Overview of Google crawlers and fetchers (HTTP caching) – Google Search Centraldevelopers.google.com
Last updated: