Cloudflare Cache Response Rules: Override Origin Caching Headers

Cloudflare · 23 Jul 2026 · 2 min read

#cloudflare

Cloudflare has introduced Cache Response Rules, a new feature that gives developers granular control over how origin response headers affect caching. Often, a stray Set-Cookie or Cache-Control: private can prevent content from being cached, even when it's safe to do so. Cache Response Rules let you override these headers at the edge, without modifying your origin server.

Key changes include:

  • New rule type: Cache Response Rules are evaluated after the origin responds, before the response is cached. They can modify the response's Cache-Control or remove Set-Cookie headers to enable caching.
  • Flexible matching: Rules can match on URL, request headers, response headers, cookies, and more—similar to other Cloudflare Rules products.
  • Override actions: You can set a specific Cache-Control value (e.g., public, max-age=3600) or remove Set-Cookie entirely. Actions include "Set Cache-Control" and "Remove Set-Cookie".
  • Edge-side logic: Rules run on Cloudflare's global edge network, not on your origin, reducing origin load and improving performance.
  • Pricing: Cache Response Rules are available on all plans. Free plan includes 5 rules; paid plans have higher limits.

For developers, this means you can now cache dynamic content that previously bypassed cache due to origin headers you cannot change (e.g., legacy systems, third-party backends). By stripping Set-Cookie or rewriting Cache-Control, you can dramatically improve cache hit rates and reduce latency. This is particularly useful for API responses, static assets returned with incorrect headers, or pages that inadvertently set cookies.

Source: https://blog.cloudflare.com/introducing-cache-response-rules/

Related

auto-curated · source linked above ← all news