Freshness
Cacheability
Validation
Request-only
Cache-Control Header Builder
Build a valid HTTP Cache-Control header by selecting directives. The resulting value is ready to copy into a server config, .htaccess, or CDN rule.
Quick presets
| Preset | Header value | Use case |
|---|---|---|
| Immutable asset | public, max-age=31536000, immutable | Fingerprinted JS/CSS/images (cache forever) |
| HTML page | no-cache | Dynamic pages, always revalidate before serving |
| API / dynamic | private, no-store | Personalized responses (user data, tokens) |
| No cache | no-store, no-cache, must-revalidate | Maximum freshness enforcement |
Key directive explanations
- public: the response can be cached by any cache (browser, CDN, proxy)
- private: only the browser can cache; CDNs and shared caches must not
- no-cache: the cached copy must be revalidated with the server on every request (not "no caching": the name is misleading)
- no-store: never cache, never store on disk. For sensitive data.
- max-age=N: the response is fresh for N seconds; the browser serves it directly without hitting the server
- immutable: tells the browser the resource will never change for the duration of max-age; prevents conditional requests
- must-revalidate: once stale, the cache must not serve the stale copy; it must revalidate or fail
Caching strategy guide
The most effective caching strategy combines long-lived caching for fingerprinted assets (immutable) with short or no caching for HTML documents. This way, deploying a new version with new asset filenames forces browsers to fetch fresh assets, while the HTML is always current.