← Back
Cloudflare
Cloudflare adds Cache Response Rules to control origin caching without origin changes

What's New

Cloudflare has introduced Cache Response Rules, a new capability that evaluates and modifies origin responses before they are cached. This extends the existing Cache Rules system to include a response phase, giving developers granular control over caching behavior without touching their origin infrastructure.

Key Capabilities

Cache Response Rules let you:

  • Modify Cache-Control Directives: Add, remove, or override individual directives like no-store, no-cache, max-age, s-maxage, stale-while-revalidate, and immutable. For example, strip a no-cache directive to allow caching of responses that would otherwise be uncacheable.
  • Set Different Browser Cache-Control: Send a different Cache-Control header to end browsers and clients than what Cloudflare uses internally, enabling independent control over edge and browser caching strategies.
  • Manage Cache Tags: Add, set, or remove cache tags on responses, and convert tag formats from other CDNs into Cloudflare's Cache-Tag header for seamless migrations.
  • Strip Problematic Headers: Remove Set-Cookie, ETag, or Last-Modified headers that prevent caching, allowing otherwise uncacheable responses to be stored and served from cache.

Why This Matters

This feature removes friction from several common scenarios:

  • No origin changes required: Fix caching behavior entirely within Cloudflare, even when origin configuration is locked down or managed by another team.
  • Easier CDN migration: Match caching behavior from other providers without rewriting origin code or configuration, and automatically translate cache tag formats.
  • Built-in functionality: Capabilities that previously required workarounds are now native features, with full Tiered Cache compatibility.

Getting Started

Access Cache Response Rules in the Cloudflare dashboard under Caching > Cache Rules, or use the Rulesets API. Rules support expressions to match on request and response attributes, and are stackable with existing Cache Rules for composable control.