Worker Subrequests, Zone Routing, and Page Rule Interaction
How same-zone and cross-zone Worker fetches behave with bindings, headers, WAF fields, Page Rules, API routing, and SSL.
This page summarises Cloudflare Workers documentation on Worker subrequests: fetches a Worker script makes to another hostname while handling a request. Most confusion comes from same zone versus other zone paths, because routing, bindings, edge rules, and security headers behave differently on each path.
Same-zone subrequests versus other-zone subrequests
Section titled “Same-zone subrequests versus other-zone subrequests”A same zone subrequest is a subrequest your Worker makes to an orange-cloud (proxied) hostname in the same Cloudflare zone where that Worker runs. Depending on DNS layout, anything that does not match that definition may be treated as an other zone request on the Cloudflare network.
A same zone subrequest is a request the Worker makes to an orange-clouded hostname in the same zone the Worker runs on. Depending on your DNS configuration, any request that falls outside that definition may be considered an other zone request by the Cloudflare network.
— Cloudflare, Workers with Page Rules
That distinction drives Page Rule handling, rate limiting, WAF expressions, Worker-to-Worker fetch, and how client IP headers are set.
Worker-to-Worker fetch: routes, Custom Domains, and service bindings
Section titled “Worker-to-Worker fetch: routes, Custom Domains, and service bindings”On one zone, a Worker cannot reach another Worker on a route or workers.dev subdomain with a plain fetch alone; you need a service binding.
On the same zone, the only way for a Worker to communicate with another Worker running on a route, or on a workers.dev subdomain, is via service bindings.
— Cloudflare, Custom Domains
If the target Worker is attached to a Custom Domain (not only a route), same-zone fetch without a binding is allowed:
On the same zone, if a Worker is attempting to communicate with a target Worker running on a Custom Domain rather than a route, the limitation is removed. Fetch requests sent on the same zone from one Worker to another Worker running on a Custom Domain will succeed without a service binding.
— Cloudflare, Custom Domains
Example from the docs: worker-a on auth.example.com/* calling https://shop.example.com fails when shop.example.com is a route; it succeeds when shop.example.com is a Custom Domain for worker-b.
API Shield routing to a Worker on the same zone
Section titled “API Shield routing to a Worker on the same zone”API Routing cannot use a Worker as the target when source and target sit in the same zone. You also cannot change the HTTP method on rewrite, and every path variable in the source path must appear in the target path (dropping {var1} on rewrite errors).
CF-Connecting-IP and x-real-ip on subrequests
Section titled “CF-Connecting-IP and x-real-ip on subrequests”HTTP headers on subrequests depend on destination type:
| Subrequest target | CF-Connecting-IP / x-real-ip behavior |
|---|---|
| Same-zone (proxied in your zone) | CF-Connecting-IP follows x-real-ip (client IP). The Worker may change x-real-ip, which affects what downstream sees. |
| Cross-zone (one Cloudflare zone to another) | CF-Connecting-IP is set to 2a06:98c0:3600::103 (Worker client IP) for security. |
| Non–Cloudflare customer zone | The Worker controls both headers; unchanged forwarded headers can show the real client IP. |
| No subrequest | cf-connecting-ip is the client IP; x-real-ip is stripped. |
To authenticate that traffic originates from your own zone, use zone-level or per-hostname Authenticated Origin Pulls with your own certificate, or Cloudflare Tunnel.
— Cloudflare, HTTP headers reference
Do not rely on cross-zone subrequests to preserve the visitor’s IP for origin logic unless you design headers explicitly and understand the fixed Worker client IP case.
Page Rules when traffic hits a Worker or a subrequest
Section titled “Page Rules when traffic hits a Worker or a subrequest”Many Page Rules may not behave as you expect when the incoming request matches a Worker route, because Cloudflare disables the Page Rule’s default effect for that path when the request is destined for a Worker. Cloudflare notes that runtime changes mean detailed per-rule docs are updated after testing.
Behavior is classified by who initiates the request and where it goes:
| Page Rule (examples) | Client → Worker | Worker → same zone | Worker → other zone |
|---|---|---|---|
| Always Use HTTPS | Respected | Ignored | Ignored |
| Automatic HTTPS Rewrites | Ignored | Respected | Ignored |
| Browser Cache TTL | Ignored | Respected | Ignored |
| Browser Integrity Check | Respected | Ignored | Ignored |
| Cache Deception Armor | Respected | Respected | Ignored |
| Cache Level | Respected | Respected | Ignored |
| Disable Zaraz | Respected | Respected | Ignored |
| Edge Cache TTL | Respected | Respected | Ignored |
| Email Obfuscation | Ignored | Respected | Ignored |
| Forwarding URL | Ignored | Respected | Ignored |
| IP Geolocation Header | Respected | Respected | Ignored |
| Origin Cache Control | Respected | Respected | Ignored |
| Rocket Loader | Ignored | Ignored | Ignored |
| Security Level | Respected | Ignored | Ignored |
| SSL | Respected | Respected | Ignored |
Rules listed as potentially affected when a request is Worker-bound also include Always Online, Always Use HTTPS, Automatic HTTPS Rewrites, Browser Cache TTL, Browser Integrity Check, Cache Deception Armor, Cache Level, Disable Apps, Disable Zaraz, Edge Cache TTL, Email Obfuscation, Forwarding URL, Host Header Override, IP Geolocation Header, Origin Cache Control, Rocket Loader, Security Level, and SSL—see Workers with Page Rules for the full list.
Practical takeaway: Page Rules you rely on for visitor → Worker traffic may still apply, but Worker-initiated same-zone fetches often follow a different subset (for example cache TTL respected, Always Use HTTPS ignored). Other-zone subrequests usually ignore these Page Rules entirely in the tables above—plan caching, HTTPS, and security in the Worker or on the target zone instead.
WAF: cf.worker.upstream_zone for subrequest traffic
Section titled “WAF: cf.worker.upstream_zone for subrequest traffic”For custom and rate limiting rules, use the request field cf.worker.upstream_zone, not the CF-Worker header.
The
cf.worker.upstream_zonefield identifies the zone that spawned a Workers subrequest. You can use this field in custom rules to mitigate unwanted Worker traffic.— Cloudflare, Block Worker subrequests from other zones
Block subrequests from other zones only
Section titled “Block subrequests from other zones only”To block Worker subrequests from foreign zones but allow normal visitors and your own zone’s Workers:
(not cf.worker.upstream_zone in {"" "your-zone.com"})Action: Block. The empty string matches requests not from a Worker, so direct visitor traffic is unaffected (use case).
Rate limiting and same-zone subrequests
Section titled “Rate limiting and same-zone subrequests”With Also apply rate limiting to cached assets set to false, Cloudflare may count same-zone Worker subrequests as separate requests, so limits trigger sooner (troubleshooting).
Exclude same-zone Worker subrequests by extending the rule expression, for example:
and (cf.worker.upstream_zone == "" or cf.worker.upstream_zone != "<YOUR_ZONE>")The empty string matches direct visitor requests; the inequality matches subrequests not from your zone—together they skip same-zone Worker subrequests.
TLS to origins outside your zone (Error 526)
Section titled “TLS to origins outside your zone (Error 526)”Subrequests to hostnames outside your zone that are not proxied by Cloudflare always use Full (strict) SSL, regardless of the Workers zone SSL setting:
Workers subrequests to any hostname outside your Cloudflare zone that is not proxied by Cloudflare are always made using the Full (strict) SSL mode, regardless of the Workers zone configuration.
— Cloudflare, Error 526
A valid origin certificate and hostname match are required; otherwise you may see 526 errors on those fetches even when the zone UI uses a looser SSL mode for browser traffic.
Cloudflare Access on Worker URLs
Section titled “Cloudflare Access on Worker URLs”Multiple Access policies can apply to one Worker. Cloudflare Access resolves most specific first:
- Hostname or path-based Access (e.g.
admin.example.com,example.com/login) - Worker-level Access (selected Worker: routes, Custom Domains,
workers.dev, previews) - Account-level Worker Access (fallback for all Workers / previews on the account)
Removing a narrower rule can expose a broader one still in force—for example, removing Worker-level Access may leave account-level Access active.
Common mistakes
Section titled “Common mistakes”- Calling another Worker on a route in the same zone with
fetch()instead of a service binding or Custom Domain on the target (Custom Domains). - Writing WAF rules against
CF-Workerinstead ofcf.worker.upstream_zone(block subrequests). - Expecting Page Rules on same-zone subrequests to mirror client → Worker behavior (e.g. Always Use HTTPS ignored on Worker → same zone) (Workers with Page Rules).
- Rate limiting internal same-zone Worker chains without excluding
cf.worker.upstream_zone(rate limiting troubleshooting). - Assuming the visitor IP appears on cross-zone subrequests (
CF-Connecting-IPfixed to the Worker client address) (HTTP headers). - Routing API traffic to a Worker target in the same zone via API Shield (API Routing limitations).
How to check this on your site
Section titled “How to check this on your site”-
Identify whether internal calls are same zone (orange-cloud hostnames in the Worker’s zone) or other zone / external, using the definition in Workers with Page Rules.
-
For Worker-to-Worker calls on one zone, confirm the target uses a Custom Domain or a service binding; test a route-only target and expect failure without a binding (Custom Domains).
-
In WAF → custom rules, verify expressions use
cf.worker.upstream_zone(notCF-Worker) and match the block-other-zones pattern if you restrict foreign Worker traffic. -
For rate limiting, review whether same-zone subrequests should be excluded via
cf.worker.upstream_zoneper troubleshooting; trigger a test burst that includes internal Workerfetchcalls. -
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page looks wrong or you need a clarification, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about.