Back to Cloudflare

Rules Execution: Follow a Request Across Phases

November 5, 2026 Updated November 6, 2026 Wasil Zafar 26 min read

Resolve overlapping matches with product-specific precedence

Table of Contents

  1. A Request Passes Through Multiple Rule Phases
  2. Matching Fields Can Change After a Rewrite
  3. Overlapping Actions Need Product-Specific Precedence
  4. Migration Requires Behavior Tests Rather Than Syntax Replacement
  5. Trace Three Overlapping Rule Configurations
  6. Predict and Verify the Final URL, Headers, and Origin

A Request Passes Through Multiple Rule Phases

Imagine a parcel moving through a sorting hub. At each station a clerk photographs the parcel as it arrives, then works only from that photograph. If the clerk at station three repacks the box, the clerk at station four still reads station four's own photograph — taken when the parcel reached them, showing the repack. Nobody consults a single master description of the parcel, and nobody can reach back and change an earlier photograph.

Cloudflare's request pipeline works like that. Each station is a phase: a fixed stage in the life of a request, defined by Cloudflare and not reorderable by customers. Each phase holds one or more rulesets, and a ruleset is an ordered list of rules. A rule is a filter expression plus an action. The photograph is the field snapshot: the values of every request field as they exist when that phase begins.

Take one request: GET https://shop.example.com/collections/sale?utm_source=email. A realistic zone might have all of the following configured at once, and every one of them addresses a different stage.

Configured rulePhaseWhat it does to this request
Single Redirecthttp_request_dynamic_redirectSends /collections/sale to /collections/clearance
URL Rewritehttp_request_transformMaps /collections/* to /catalog/*
Configuration Rulehttp_config_settingsTurns off Rocket Loader for /collections/*
Origin Rulehttp_request_originRoutes /collections/* to a legacy backend
WAF custom rulehttp_request_firewall_customBlocks paths containing /catalog/admin
Cache Rulehttp_request_cache_settingsMarks /collections/* eligible for cache with a 60-second edge TTL
Worker routeAfter the rule phasesHandles every request on shop.example.com/*

These do not compete in one list. Each belongs to a different phase, and phases run in a fixed order. Figure 1 traces the request through the application-layer request phases, with the two exits that end it early.

A Request Passes Through Multiple Rule Phases
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
    C["GET shop.example.com/collections/sale"] --> R["http_request_dynamic_redirect
Single Redirects"] R -->|"match"| X["3xx + Location
request ends here"] R -->|"no match"| N["http_request_sanitize
URL normalization"] N --> T["http_request_transform
URL Rewrite Rules"] T --> CFG["http_config_settings
Configuration Rules"] CFG --> O["http_request_origin
Origin Rules"] O --> WAF["http_request_firewall_custom
WAF custom rules"] WAF -->|"block or challenge"| B["403 or challenge
request ends here"] WAF -->|"no match"| RL["http_ratelimit
Rate limiting rules"] RL --> MR["http_request_firewall_managed
WAF Managed Rules"] MR --> H["http_request_late_transform
Request Header Transform Rules"] H --> CS["http_request_cache_settings
Cache Rules"] CS --> WK{"Worker route
on this hostname?"} WK -->|"yes"| WH["Worker handles request;
fetch() subrequest re-enters cache"] WK -->|"no"| CL{"Cache lookup"} WH --> CL CL -->|"hit"| Z["Response from edge cache"] CL -->|"miss"| OR["Origin receives final path,
Host, headers, port"] OR --> Z classDef primary fill:#132440,color:#ffffff,stroke:#0b172b; classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a; classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f; classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420; classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f; class O,WAF,MR,OR primary; class C,R,X,N,T,CFG,B,RL,H,CS,WK,WH,CL secondary; class Z ok;

Order creates two surprises. First, a redirect runs before any rewrite, so a redirect expression always sees the URL the visitor typed. Second, WAF custom rules run after the rewrite phase, so they evaluate the rewritten path, not the visible one. Neither behavior is a bug; both are consequences of where each product's phase sits.

Figure 2 draws the same pipeline as layers, with the snapshot boundary marked at each hand-off. The browser and the origin each hold a different idea of the URL, and the edge is the only place where both ideas are visible at once.

A Worker is not one of these phases. When a route matches, the Worker becomes the request handler after the rule phases and before the zone cache is consulted. If it calls fetch(), that subrequest passes through the cache with cache rules evaluated against the subrequest's URL, not the visitor's. This is why a cache rule can appear to be ignored by a Worker: it matched the inbound request, but the response was keyed on something else.

DNS sits at the same boundary. Origin Rules choose which hostname is resolved, so a DNS-record override changes where the request is sent without changing the URL the browser shows.

Rule phases as stations with a frozen field snapshot at each hand-off The visitor request enters the edge and passes redirect, rewrite, configuration and origin, WAF, header transform, and cache-settings phases in order. Each phase reads its own snapshot; a terminating action returns to the visitor, while cacheable responses may be served without reaching the origin. Each station reads a frozen snapshot, then hands a new one forward Browser holds the visible URL follows 3xx itself Cloudflare edge: fixed phase order, fixed snapshots Redirect sees the original URL Rewrite + Config + Origin path and host start changing WAF custom + rate limit sees the rewritten path Headers + Cache Rules keys and TTLs decided S1 S2 S3 S4 snapshot per phase Cache lookup after the Worker or in front of origin key from final fields Origin final path, Host, port, headers 3xx returns to the client a hit skips the origin entirely A block, challenge, or redirect ends the request at its phase.

Three semantic families exist inside this order, and they do not share a precedence rule.

Value-setting actions change a field: rewrite the path, set a header, override the origin, set a cache TTL. Within one phase, the last matching rule's value wins for that setting. Terminating actions — redirect, block, challenge, serve error — stop evaluation and reply immediately, so the first matching rule wins.

One zone can run two evaluation models

Within a phase, account-level rules run before zone-level rules, and account-level phases are currently Enterprise-only. Page Rules are not a phase at all: they are a legacy layer that modern rules override and Workers suppress. That is where silent skips come from.

Matching Fields Can Change After a Rewrite

The snapshot rule has a sharp edge. Within a phase, no rule sees what an earlier rule in that phase just changed.

Rules in one phase do not compose

Two rules in the same phase can both match, but the later one replaces the earlier value instead of building on it. There is no chaining inside a phase: the second rule still reads the phase's opening snapshot.

Across phases, changes do propagate. That is the point of the snapshot hand-off, and it is where most precedence bugs live. Run one request through a realistic tangle:

// Inside one phase, A rewrites /docs to /docs/v2 and B rewrites /docs to /help.
// The visitor gets B's result, not /help/v2: rules in a phase do not chain.

// 1-2. Redirect phase: no match, so the request continues unchanged.
// 3. Rewrite: the old prefix matches and the path becomes /help/new/start.
starts_with(http.request.uri.path, "/help/old/")

// 4. WAF custom: now sees /help/new/ and fires on a path nobody typed.
http.request.uri.path contains "/help/new/"

// 5. Origin Rule: still tests the old prefix, so it silently stops matching.
starts_with(http.request.uri.path, "/help/old/")

// 6. Cache Rule: keys the response under the rewritten path.
starts_with(http.request.uri.path, "/help/new/")

// Fix: pin downstream rules to what the visitor actually sent.
starts_with(raw.http.request.uri.path, "/help/old/")
# Send the request and keep the headers: final URL, status, and cache state.
curl -sS -o /dev/null -D - "https://shop.example.com/help/old/start"

The two failures mirror each other. Step 5 is the classic silent skip: nothing errors, nothing warns, the rule simply never matches again after an unrelated rewrite ships. Step 4 is its mirror image, a rule that starts firing on traffic it was never written for.

The table compares what each phase actually reads once a rewrite has run.

Stage (phase)Field the expression usually testsValue seen after the rewriteWhat to test instead
Single Redirect (http_request_dynamic_redirect)http.request.full_uriOriginal URL — a redirect ends the request, so no rewrite ever coexists with itNothing; this is the last phase that sees the visitor's URL
URL Rewrite (http_request_transform)http.request.uri.pathOriginal URL for the first matching rule; later rules in the same phase still see the originalraw.http.request.uri.path when composing with other products
WAF custom rules (http_request_firewall_custom)http.request.uri.path, http.request.uri.queryRewritten path and queryraw.http.request.uri.path to match what the visitor requested
Origin Rules (http_request_origin)http.host, http.request.uri.pathRewritten path; host unchanged unless a configuration rule changed itraw.http.request.uri.path plus raw.http.host
Cache Rules (http_request_cache_settings)http.request.uri.path, http.request.host, cookies, headersRewritten path; header values set in the late-transform phaseraw.* fields, or key on a header that no rule modifies
Request Header Transform (http_request_late_transform)http.request.headersHeaders as they arrived; a header set by an earlier rule in this phase is invisible to later rulesOrder rules deliberately and set each header once

The escape hatch is the raw field family. Fields prefixed raw. are immutable for the whole request workflow, so raw.http.request.uri.path keeps reporting the path the visitor sent no matter how many rewrites run.

Use the same raw expression on both sides

Cloudflare documents this explicitly as the fix for rewrites breaking later rules, and recommends the same raw expression in both the rewrite and the downstream rule. Figure 3 shows the two failure branches that appear when the raw field is omitted.

Matching Fields Can Change After a Rewrite
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
    A["Request /help/old/start"] --> B{"Redirect phase
full_uri matches?"} B -->|"yes"| X["3xx to visitor
rewrite never runs"] B -->|"no"| C["Rewrite phase:
/help/old/* to /help/new/*"] C --> D["New snapshot for later phases
path is now /help/new/start"] D --> E{"WAF rule tests
/help/new/ ?"} E -->|"yes"| F["Fires on a path nobody typed
possible false block"] E -->|"no"| G{"Origin rule tests
/help/old/ ?"} G -->|"stopped matching"| H["Silent skip: default origin,
no error, no log"] G -->|"raw field used"| I["Correct backend"] D --> J["Cache Rule keys on new path"] J --> K["Duplicate cache entry
old entry keeps serving"] classDef primary fill:#132440,color:#ffffff,stroke:#0b172b; classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a; classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f; classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420; classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f; class E,G primary; class A,B,X,C,D,I,J,K secondary; class F,H danger;

Loud versus quiet failures. A false block is loud, because the visitor sees a 403. A silent origin miss is quiet, because the page still renders — from the wrong server. Prefer raw. fields on any expression that must describe the visitor's request rather than the pipeline's current state, and reserve mutable fields for rules that intentionally react to earlier phases.

Product boundaries matter. The regex matches operator is limited to Business and Enterprise; Origin Rules can override host, SNI, and resolved DNS only on Enterprise, while destination-port overrides work on every plan. Cache Rules quotas vary by plan. Check the availability table before designing around a field or override, and note the date you checked.

Overlapping Actions Need Product-Specific Precedence

Here is a Page Rule that a great many zones still run:

  • URL pattern: *example.com/assets/*
  • Cache Level: Cache Everything
  • Edge Cache TTL: 1 day
  • Host Header Override: assets-backend.example.net

A Page Rule is one ordered bundle. Its three actions run in the order the customer chose inside the rule. The modern equivalent is not one rule; it is two, in two different phases:

// Origin Rule, phase http_request_origin: change which backend answers.
http.host eq "shop.example.com" and starts_with(http.request.uri.path, "/assets/")
// action: rewrite the Host header to assets-backend.example.net

// Cache Rule, phase http_request_cache_settings: same match, later phase.
http.host eq "shop.example.com" and starts_with(http.request.uri.path, "/assets/")
// action: eligible for cache, edge TTL one day
# Confirm which backend answered, and whether the response was cached.
curl -sS -o /dev/null -D - "https://shop.example.com/assets/app.js"

The translation is not behavior-preserving, for three reasons. The origin override now runs before cache settings instead of wherever the bundle placed it. "Eligible for cache" enables Cache Everything by default, so a rule written to replicate a narrow Page Rule can start caching HTML that was never cached. And first-match-wins does not carry over: modern cache rules stack, and the last matching rule wins for any conflicting setting.

That last point is the misconception worth naming plainly.

Figure 4 separates the two models. On the left, a Page Rule is one ordered bundle applied at a single point. On the right, each modern action lands in its own phase, inherits that phase's snapshot, and obeys that phase's precedence class.

One Page Rule bundle versus three modern actions distributed across phases A Page Rule applies cache level, edge TTL, and host override as one ordered bundle at one evaluation point. Modern rules split the same intent into an origin rule and a cache rule in separate fixed phases, each with its own snapshot and its own precedence class. Legacy: one bundle, one moment Modern: three phases, three snapshots Page Rule: *example.com/assets/* 1. Cache Everything 2. Edge TTL 1 day 3. Host header override Order chosen by the customer. First matching Page Rule wins. Origin Rule — http_request_origin Host override, applies first here Cache Rule — cache_settings Eligible + TTL, later snapshot WAF / Worker — later phases May override or bypass intent Assumption that breaks: that the bundle still runs as a unit. Each action now obeys its own phase order and precedence class. A broad later Cache Rule can override the specific one. A Worker on the route suppresses Page Rules, not these.

Precedence is a short decision procedure, not a single ranking:

  1. Phase order decides who goes first. Redirect, then sanitize, then transform, then configuration, then origin, then WAF custom rules, then rate limiting, then Managed Rules, then late header transforms, then cache settings, then snippets.
  2. Account before zone within the same phase, where account-level phases are available.
  3. Within a phase, for value-setting actions, the last matching rule wins per setting. Cache Rules merge; if two rules disagree on cache eligibility, the later one decides.
  4. Within a phase, for terminating actions, the first match wins and evaluation stops. If two redirect products could both match, the earlier phase wins — Single Redirects before Bulk Redirects.
  5. Skip removes evaluation, and it is scoped. A zone-level skip affects zone-level phases; an account-level skip affects only account-level configuration.
  6. Page Rules lose to modern rules on the same path, and lose entirely when a Worker handles the request.

Two operational failures follow directly from paths that other systems already own.

Rules that capture platform paths

A redirect matching /cdn-cgi/* intercepts the challenge platform's own requests and produces a challenge loop. Exclude /cdn-cgi/challenge-platform/ from any rule that challenges or redirects broadly.

A redirect matching /.well-known/* breaks HTTP domain control validation and custom hostname verification, so certificate renewals fail weeks later with no visible link to the rule. Both failures are precedence working as designed.

Migration Requires Behavior Tests Rather Than Syntax Replacement

Translating syntax is the easy half. A Page Rule pattern such as *example.com/assets/* becomes an expression, and the dashboard will even offer templates that fill it in. The hard half is that the translated rule now participates in a different evaluation model, and three classes of behavior change are invisible in a syntax diff.

First-match becomes stackable. A Page Rule won because it was first. A modern rule with the same expression competes with every other rule in its phase, and a broad catch-all placed later will override it. The migration question is not "what did this rule do" but "what else now matches the same request, and in what order".

A bundle becomes a phase-ordered set. Actions that ran in a customer-chosen sequence now run in Cloudflare's fixed sequence. An origin override that used to happen after cache settings may now happen before them. When the actions are independent the difference is invisible; when one action's input is another's output, it is decisive.

Defaults drift. "Eligible for cache" turns on Cache Everything, which the equivalent Page Rule required explicitly. A faithful-looking translation can therefore start caching HTML responses that were never cached, including pages with personalized fragments.

Some boundaries resist syntax replacement entirely. Workers suppress Page Rules but not modern rules, so migrating with a Worker on the route changes which actions apply. Legacy WAF Managed Rules and legacy Rate Limiting cannot be disabled by modern rules, so "Disable Security" Page Rules have no complete equivalent. And the migration guide's 30 October 2026 revision still calls automatic migration "planned" for late 2025 or beyond — verify current status rather than assume it has passed.

Figure 5 shows the same intent under both models and the failure path that a syntax-only migration walks into.

Before and after migration, with the stackable-order failure path Before migration a specific Page Rule wins because Page Rules are first-match. After migration the same specific rule competes with a broad catch-all cache rule that appears later and therefore wins, silently changing cache behavior. A behavior test compares the two outcomes before the Page Rule is deleted. Before: first match wins After: last match wins in phase Specific Page Rule /assets/* — Cache Everything, 1 day Broad Page Rule /* — Bypass cache Outcome: /assets/* is cached for a day. Specific Cache Rule /assets/* — Eligible for cache, 1 day Broad Cache Rule, placed later /* — Bypass cache Outcome: last match wins, /assets/* bypasses cache. Failure path Syntax matched. Behavior inverted. No error, no alert, origin load rises. Behavior test Same request, both models, compare cf-cache-status before deleting anything. A migration is complete when the observed response matches, not when the rule list looks equivalent. Keep the Page Rule disabled, not deleted, until the comparison passes on live traffic.

The practical method is a behavior test, not a review. Build the modern rule disabled and simulate the request in Rules simulator to see the evaluation order and confirm which rules match. The simulator is in Beta, requires an Administrator or Super Administrator role, and does not display rules bypassed automatically for operational reasons such as certificate validation paths. Then enable the modern rule alongside a disabled Page Rule, drive real traffic, and compare what each version actually returns.

# Run the same probe against the Page Rule, then against the modern rule.
# Keep status, redirect target, cache state, and age from both runs.
curl -sS -o body.html -D headers.txt "https://shop.example.com/assets/app.js"
grep -Ei '^(HTTP/|location|cf-cache-status|age|cache-control)' headers.txt

Compare across conditions, not once. The comparison has to hold across methods, cookies, query strings, bot user agents, and at least one authenticated session before the Page Rule is switched off — and only after a further observation window should it be deleted.

The tradeoff is honest: more precision, more surfaces to test. Replacing syntax without testing behavior has not migrated anything; it has deployed a hypothesis.

Trace Three Overlapping Rule Configurations

The exercise below is design-only. It has not been executed for this article, no zone was modified, and no measurements are reported. Everything labeled "expected" is a prediction derived from the documented phase order, to be confirmed on your own zone.

Guided exercise

Trace Three Overlapping Rule Configurations

Status: design-only, not executed. Prerequisites: a zone you control with a proxied DNS record; access to Rules, Cache Rules, and Workers; permission to create a WAF custom rule; a Worker deployed on a route for the lab hostname. Cache Rules and WAF custom rules exist on all plans with plan-dependent quotas, while some Origin Rule overrides are Enterprise-only — confirm your plan before including them.

Setup. Use a dedicated hostname such as lab.example.com and one Worker that echoes each request as JSON: method, URL, host header, and any lab-prefixed headers. Create an origin path that returns a distinctive header so you can tell which backend answered.

Rules to create, in this order.

  1. Single Redirect: when http.request.uri.path eq "/lab/start", redirect 302 to /lab/final, preserving the query string.
  2. URL Rewrite: when starts_with(http.request.uri.path, "/lab/old/"), rewrite the path by replacing /lab/old/ with /lab/new/.
  3. WAF custom rule: block when http.request.uri.path contains "/lab/new/admin".
  4. Cache Rule: when starts_with(http.request.uri.path, "/lab/new/"), eligible for cache with a 60-second edge TTL.
  5. Origin Rule (optional, Enterprise for host override): when starts_with(http.request.uri.path, "/lab/old/"), rewrite the host to legacy.example.net.

Action: predict before you send. Write down the expected status code, final URL, cache status, and receiving origin for each probe, then send it and compare.

ProbeWhat to predictWhat it tests
GET /lab/start?ref=emailWhich wins: redirect or rewritePhase order between redirect and transform
GET /lab/old/pageWhat the WAF sees, and whether the Origin Rule still matchesSnapshot propagation into later phases
GET /lab/old/adminWhether the block fires before or after the rewriteWAF phase placement
GET /lab/new/page, twice inside 60 secondsThe cache status on each responseCache key built from the post-rewrite path
GET /lab/old/page with a cookie setWhether the cache rule still appliesCookie handling in cache eligibility

Expected observations.

  • Probe 1: a 302 to /lab/final; the Worker never runs, because the redirect phase precedes the transform phase.
  • Probe 2: the page renders, but later phases see /lab/new/page. The Origin Rule does not fire because it tests the pre-rewrite path; check the Worker's echoed URL to confirm what it saw.
  • Probe 3: a block, because WAF custom rules run after the rewrite phase.
  • Probe 4: a miss then a hit, since the cache key is built from the post-rewrite path.
  • Probe 5: depends entirely on the cache rule's cookie handling. If the expression ignores cookies while the origin varies on them, you have reproduced the personalization leak from the cache-rules article.

Failure checks. If probe 1 reaches the Worker, the redirect rule's expression is wrong or the rule is disabled. If probe 3 returns 200, either the WAF expression tests the old path or the rule sits in a phase that never runs for that hostname. If probe 2 hits the legacy origin, the Origin Rule is matching when you expected it to skip — check whether you used raw.http.request.uri.path. If probe 4 never hits, confirm the response is actually cacheable and that no later cache rule sets bypass.

Cost. One Worker request per probe, a handful of rule evaluations, and negligible bandwidth. Cache storage for one small object for 60 seconds. No paid add-on is required for the core trace.

Cleanup. Delete all five rules, remove the Worker route, delete the Worker, and purge the lab hostname's cache so the 60-second object does not outlive the exercise.

Predict and Verify the Final URL, Headers, and Origin

Verification for this article was performed against Cloudflare's documentation on 2026-11-05, with a planning baseline of 2026-11-02. No hosted lab was executed: the editorial record for this topic is lab_status: not_run, and every behavioral statement below is a documentation-derived expectation rather than a measurement.

Pass criteria for the method. A trace is trustworthy when all of the following hold. It fails if any one does not.

  • Pass: the predicted final URL is stated before the request is sent, including scheme, host, path, and query string.
  • Pass: each rule that matched is named together with its phase, and each rule that did not match has a stated reason — no match, skipped, terminated earlier, or overridden later.
  • Pass: the receiving origin and the Host header it saw are both recorded, not just the status code.
  • Fail: the explanation is "the rule did not fire" with no phase assigned to it.
  • Fail: a redirect and a rewrite are described as if they compose. A redirect ends the request; the browser starts a new one.
  • Fail: cache behavior is inferred from the URL alone without checking cf-cache-status and age.

Self-check. Answer before reading the explanations.

  1. A Single Redirect and a URL Rewrite both match /promo. Which runs, and does the other still apply?
  2. Two Cache Rules match the same path. Rule A sets a one-day edge TTL; rule B, placed later, sets bypass. What happens?
  3. A custom rule blocking /internal/login no longer fires after a rewrite ships, and a rule blocking /public-login starts firing. Why?
  1. The redirect runs, in http_request_dynamic_redirect, and the request ends with a 3xx. The rewrite never executes for that request; the browser's follow-up request is a new request and may then match the rewrite if its path does. Redirect and rewrite are alternatives in sequence, not layers.
  2. Cache is bypassed. Both rules are non-terminating, both match, and for conflicting settings the last matching rule wins. The one-day TTL from rule A is overridden, not merged into a compromise.
  3. The rewrite phase runs before WAF custom rules, so the path the WAF evaluates changed. The /internal/login rule now sees a path that no longer matches, and the /public-login rule sees the rewritten path that visitors never typed. Either rewrite the WAF expressions or move both to raw.http.request.uri.path.

Unresolved limitations. Rules simulator is Beta and omits automatic operational bypasses, so a clean simulation is not proof that a rule will fire in production. Plan-gated features — regular-expression matches, Origin Rule host/SNI/DNS overrides, account-level phases — could not be exercised without an entitled zone. Page Rules migration status is documented as planned rather than complete, and the exact timing may have changed since the cited revision. Worker visibility of a rewritten path was not verified in a hosted environment and should be confirmed in your own trace before it is relied on. Finally, no latency or cache-hit-rate numbers are claimed here; those require measurement on real traffic.

Authoritative references.

  • Cloudflare Rules overview — https://developers.cloudflare.com/rules/
  • Ruleset Engine: Phases — https://developers.cloudflare.com/ruleset-engine/about/phases/
  • Ruleset Engine: Phases list (execution order) — https://developers.cloudflare.com/ruleset-engine/reference/phases-list/
  • Ruleset Engine: Rules and field values during evaluation — https://developers.cloudflare.com/ruleset-engine/about/rules/
  • Ruleset Engine: Actions, including terminating and skip semantics — https://developers.cloudflare.com/ruleset-engine/rules-language/actions/
  • Page Rules migration guide — https://developers.cloudflare.com/rules/reference/page-rules-migration/
  • Cache Rules: Migration from Page Rules — https://developers.cloudflare.com/cache/how-to/cache-rules/page-rules-migration/
  • Cache Rules: Order and priority — https://developers.cloudflare.com/cache/how-to/cache-rules/order/
  • WAF: Rule phase interactions — https://developers.cloudflare.com/waf/troubleshooting/phase-interactions/
  • Rules: Troubleshoot Rules (rewrites, challenges, DCV paths) — https://developers.cloudflare.com/rules/reference/troubleshooting/
  • Rules simulator — https://developers.cloudflare.com/rules/simulator/
  • Rules simulator limitations — https://developers.cloudflare.com/rules/simulator/limitations/
  • Cache and Workers interaction — https://developers.cloudflare.com/cache/interaction-cloudflare-products/workers/