Advertising disclosure: We may earn a commission from links on this site. Commercial relationships can affect placement. Product facts, limitations, and source dates remain part of our editorial record.

How funding works
Web Hosting

Cloudflare CDN-Cache-Control: A Guide for Website Owners

Learn how Cloudflare's CDN-Cache-Control response header separates edge caching from browser rules, sets stale behavior, and avoids precedence mistakes.

Review sources
Research standard

Facts that can change should include a source and check date. Benchmark claims should state the plan, region, method, and test period.

If you need Cloudflare to cache a response at the edge for a different period than a browser or another shared cache, have your origin send CDN-Cache-Control. Cloudflare documents it as an origin response header that uses directives also found in Cache-Control, including max-age and stale-if-error. This separates CDN instructions from browser and other intermediary-cache instructions.

The three relevant headers#

CDN-Cache-Control is generated by the origin as part of an HTTP response. The related headers have different audiences:

Data table from this page
HeaderPrimary audienceRole
Cache-ControlBrowsers and shared cachesProvides general cache instructions.
CDN-Cache-ControlCloudflare and potentially downstream CDNsProvides CDN-specific cache instructions.
Cloudflare-CDN-Cache-ControlCloudflareProvides Cloudflare-specific instructions and is not passed downstream.

Cloudflare describes its cache as storing copies of frequently accessed website content in distributed data centers. Its documentation also shows how separate TTLs can be assigned to origin caches, shared caches, Cloudflare's edge, other CDNs, and browsers. The purpose of the header family is to let those layers follow different freshness policies where needed.

Cloudflare-specific precedence rules#

When both Cloudflare-CDN-Cache-Control and CDN-Cache-Control are present, Cloudflare uses Cloudflare-CDN-Cache-Control for its own caching decisions while forwarding CDN-Cache-Control. This lets Cloudflare follow one policy while a downstream CDN can receive another.

A Cloudflare Cache Response Rule using set_cache_control takes precedence over CDN headers set by the origin. Check for such a rule when the behavior at Cloudflare does not match the response configuration.

These forwarding and precedence rules are specific to Cloudflare. Other CDN providers may interpret these headers or resolve conflicts differently.

Freshness and stale content#

Cloudflare documents max-age and stale-if-error among the directives that can be used with CDN-Cache-Control. Use the freshness directives to define how long a response may be reused, and use stale-if-error to control how long stale content may be served during an error or revalidation event.

Choose durations according to how often the content changes and how much stale content is acceptable. A longer edge TTL can reduce how often Cloudflare needs a new copy, but it also means an intentional content change may require cache invalidation or a wait for the existing policy to expire.

A practical setup process#

  1. Decide the policy for each layer: browsers, shared caches, Cloudflare's edge, downstream CDNs, and any relevant origin caches.
  2. Put general browser and shared-cache instructions in Cache-Control.
  3. Put CDN-specific instructions in CDN-Cache-Control when Cloudflare or a downstream CDN should use a different policy.
  4. Use Cloudflare-CDN-Cache-Control only when Cloudflare needs instructions that should not be passed to downstream CDNs.
  5. Review Cloudflare Cache Response Rules, especially rules using set_cache_control, because they can override origin-set CDN headers.
  6. Inspect the actual response headers and observe cache behavior separately. The header in the origin configuration shows the intended policy; it does not replace checking what the delivered response contains.

If cached content must be removed or reconfigured, Cloudflare documents Cache Rules and purge controls for configuring or removing cached content. Recheck the response after making that change, particularly when a rule and an origin header could both apply.

Sources

  1. Cloudflare: CDN-Cache-Control Checked 2026-09-26
  2. Cloudflare cache documentation Checked 2026-09-26