Skip to main content
sitewarm
HTTP caching headers

What is the CDN-Cache-Control header?

CDN-Cache-Control is a targeted header, defined in RFC 9213, that sets caching rules for CDNs only and overrides Cache-Control there.

CDN-Cache-Control is a targeted cache-control header, defined in RFC 9213, that applies only to CDNs. It uses the same directives as `Cache-Control`. A CDN that supports it uses its value and ignores Cache-Control and Expires for that response, while browsers keep following Cache-Control.

Cache-Control: max-age=60
CDN-Cache-Control: max-age=86400
Cloudflare-CDN-Cache-Control: max-age=3600

RFC 9213 lets each cache keep a target list, an ordered set of fields it reads, such as a vendor-specific field first and CDN-Cache-Control second. The cache uses the first valid, non-empty one, and falls back to Cache-Control if none is valid.

  • Vendor fields include Cloudflare-CDN-Cache-Control and Netlify-CDN-Cache-Control. Vercel also reads CDN-Cache-Control.
  • It is a clearer way to split edge and browser lifetimes than `s-maxage`, which every shared cache, including corporate proxies, reads.
  • Directives keep their meaning: `no-store` and no-cache still make max-age inoperative.

A long edge TTL is safe when you purge on deploy and warm the cache right after.

Some CDNs add their own variant, such as Cloudflare-CDN-Cache-Control, Vercel-CDN-Cache-Control or Netlify-CDN-Cache-Control. See the Cloudflare, Vercel and Netlify guides, and the Top 10 CDNs comparison.

References

  1. RFC 9213: Targeted HTTP Cache Controlhttps://www.rfc-editor.org/rfc/rfc9213
  2. Cloudflare: CDN-Cache-Controlhttps://developers.cloudflare.com/cache/concepts/cdn-cache-control/
  3. Vercel: CDN Cachehttps://vercel.com/docs/caching/cdn-cache

Warm your cache after every deploy

sitewarm requests the pages in your sitemap after a deploy and reports the cache state the CDN returns for each one, with the vantage point it was measured from.