Cache Rules: Ten Years of Page Rules, Refined
In 2012, Cloudflare launched Page Rules, giving website owners granular control over caching, security, header manipulation, redirects, and more. A decade later, more than 3.5 million caching Page Rules are live, helping customers fine-tune how their content is served. Now, after years of observing how those rules are used, Cloudflare is evolving rules-based caching into a more flexible and transparent system.
Page Rules is being split into four product-specific rule sets: Origin Rules, Cache Rules, Configuration Rules, and Redirect Rules. This article focuses on Cache Rules and how they build on what was learned from Page Rules.
Matching Beyond URLs
Page Rules limited users to URL patterns like example.com/images/scr*. Cache Rules expands the criteria for triggering caching behavior. You can now match on HTTP request headers, file types, cookies, user-agents, hostnames, or any combination of these fields. URL matching remains available, but it's no longer the only option.
For example, targeting all PNG images can be expressed concisely:
any(http.request.headers["content-type"][*] == "image/png")
Conditions can be stacked with AND and OR operators, allowing complex rules to be built from simple building blocks. The full set of matchable fields is documented in the Cache Rules documentation.
Why More Rules and More Precision
Behind the scenes, every rule condition is converted into regexes and evaluated against requests across 275+ data centers. The CPU cost of these evaluations has historically capped the number of rules a user could deploy. Cache Rules use targeted rule applications, consuming less CPU per evaluation. This allows users to set more rules while triggering them more precisely.
The new design also separates concerns that were previously bundled into Page Rules. Instead of a single tool that tries to handle caching, redirects, configuration, and origin behavior, each function now has its own product. This separation gives users a clearer mental model of which part of the Cloudflare stack handles what, reducing debugging time.
Precedence and Visibility
One of the pain points with mixed caching setups—Page Rules, Workers, Transform Rules—has been figuring out which rule wins. The new rules products enforce a strict precedence, and Cloudflare is adding dashboard visibility into when rules are activated.
This strict ordering also enables meaningful rule chaining. For instance, URL rewrites from Transform Rules feed into Cache Rules, and Cache Rules output feeds into IP Access Rules. Future updates plan to expose inputs and outputs across all rules products, letting you preview how a rule will behave before deploying it.
Feature Set and Availability
Cache Rules include everything caching-related that Page Rules offered:
- Cache or bypass caching for an asset
- Set edge cache TTL
- Set browser cache TTL
- Define a custom cache key
- Control stale serving, revalidation, and header-driven cache freshness
Cache Rules are available today in beta. You can configure them via the API, Terraform, or the Caching tab in the dashboard. If you have Page Rules on the same path, Cache Rules take precedence by design. A one-click migration tool for existing Page Rules is planned.
Potential future enhancements include recommending rules to boost cache hit ratios and reduce egress costs, plus support for experimenting with different rule configurations to observe outcomes before committing to them.



