How to Migrate Cloudflare Page Rules to Cache Rules Without Caching Logged-In Pages
If you are still relying on legacy Cloudflare Page Rules to tune caching or set up redirects, migrating to Cloudflare’s modern Cache Rules and Redirect Rules gives you cleaner expression matching and higher rule quotas. However, copying a Page Rule expression blindly into a Cache Rule can accidentally cache /wp-admin/, checkout carts, or logged-in user dashboards—because Cache Rules behave differently from Page Rules in two critical ways.
Editorial illustration: Cache Rules stack multiple matching rules and enable Cache Everything when you select Eligible for cache.
Summary
- Per Cloudflare’s Page Rules migration guide and Cache Rules migration docs, selecting Eligible for cache in a Cache Rule enables Cache Everything by default—unlike Page Rules, where Cache Everything had to be turned on explicitly.
- Unlike Page Rules (where only the first matching rule applies), Cache Rules are stackable: multiple matching Cache Rules execute in order, with later rules overriding overlapping settings per Cloudflare’s Cache Rules order documentation.
- Always add explicit Bypass cache rules for authenticated paths (
/wp-admin/,/wp-login.php,/user/,/cart/) and session cookies (wordpress_logged_in_,woocommerce_items_in_cart,SSESS) so private pages never hit shared edge storage. - Disable your old Page Rule and validate
cf-cache-statusheaders withcurl -Ibefore deleting the legacy rule.
Two behavioral differences that trip up migrations
1. Eligible for cache turns on Cache Everything automatically
In legacy Page Rules, creating a rule for example.com/* with an Edge Cache TTL only cached default static file extensions (.css, .js, .jpg) unless you explicitly chose Cache Level: Cache Everything.
In Cache Rules, selecting Eligible for cache caches HTML and all 200 responses matching your filter unless origin headers or another rule tell Cloudflare otherwise. If your filter simply says Hostname contains "example.com" with no exclusions, Cloudflare can start caching dynamic HTML pages, admin screens, or API endpoints!
2. Multiple matching Cache Rules stack instead of stopping at the first match
In Page Rules, the top matching rule wins and evaluation stops. In Cache Rules, Cloudflare evaluates all matching rules from top to bottom and merges their settings—meaning a broad rule placed below a narrow rule can overwrite an earlier setting if they touch the same property.
Step-by-step: Migrate a caching Page Rule safely
1. Split redirects from caching rules first
Legacy Page Rules often mixed Forwarding URL rules with caching rules in one list. Move URL forwarding rules to Redirect Rules or Bulk Redirects first (see our guide on choosing between _redirects and Bulk Redirects), keeping redirect order from most specific to least specific.
2. Create explicit Bypass Cache rules for admin and logged-in traffic
Before creating broad caching rules, define what must never be cached at the edge—or place your bypass rule after broad rules if you want it to override them cleanly. For a WordPress or Drupal site, bypass:
- Admin and login paths (
/wp-admin/*,/wp-login.php,/user/*,/admin/*) - Session cookies (for example,
http.cookie contains "wordpress_logged_in_"orhttp.cookie contains "SSESS") - E-commerce cart/checkout paths (
/cart/*,/checkout/*)
Set Cache eligibility to Bypass cache.
3. Recreate your Cache Rule with clear Edge TTL and Browser TTL behavior
Follow Cloudflare’s Page Rules migration guide:
- Go to Caching > Cache Rules > Create rule.
- Match your target hostname and static/public paths (for example,
http.host eq "example.com"excluding/wp-admin/and session cookies). - Under Cache eligibility, choose Eligible for cache.
- Configure Edge TTL (for instance, Use cache-control header if present, use default Cloudflare caching behavior if not, or a specific status-code TTL) and keep Browser TTL short for HTML—see how
CDN-Cache-Controlseparates browser and edge caching.
4. Disable the old Page Rule, test, then delete
Do not delete the legacy Page Rule immediately. Toggle it Off, test both an anonymous blog page (cf-cache-status: HIT or MISS → HIT) and a logged-in admin or cart page (cf-cache-status: BYPASS or DYNAMIC), and only delete the Page Rule once every check passes. If you see unexpected stale output, review purging a stale page on Cloudflare and configuring Cloudflare WAF rate limiting for login endpoints.
Common mistakes
- Migrating a broad Page Rule without adding cookie/path bypasses. Because
Eligible for cachecaches HTML by default, forgettingwordpress_logged_in_or/user/*bypasses can serve one logged-in user’s admin bar or dashboard to another visitor. - Assuming rule #1 stops later Cache Rules from running. Because Cache Rules stack, double-check the order of every rule in Caching > Cache Rules.
- Migrating a “Cache Level: Standard” Page Rule without checking Cloudflare’s two-rule pattern. As Cloudflare’s Cache Rules migration guide notes, preserving non-“Cache Everything” behavior requires matching your file extensions or ordering your rules carefully.
Why this matters
Legacy Page Rules are limited in count and flexibility, whereas Cache Rules give you granular cookie, header, and path expressions. Understanding the Eligible for cache and stacking differences before you flip the switch prevents accidental caching of private CMS pages.
My Take
Migrate one Page Rule at a time on a quiet morning, starting with redirects and then caching rules. Always put logged-in cookie and /admin bypass rules in place first, verify cf-cache-status: BYPASS while logged in using browser DevTools, and keep the old Page Rule toggled off for 24 hours before deleting it.
Conclusion
Move URL redirects out of Page Rules into Redirect Rules, add explicit Bypass cache rules for admin paths and session cookies, configure Cache Rules knowing that Eligible for cache caches HTML and rules stack in order, and verify cf-cache-status headers before deleting legacy Page Rules.