Block Worker subrequests from other zones
Last updated Oct 5, 2026
The cf.worker.upstream_zone field identifies the zone that spawned a Workers subrequest. You can use this field in custom rules to mitigate unwanted Worker traffic.
Caution
Do not use the CF-Worker request header in WAF rules. The header is added after rule evaluation, so it is not available when WAF rules run. Use the cf.worker.upstream_zone field instead, which holds the same value.
Block subrequests from a specific zone
- When incoming requests match:
If you are using the expression editor:
(cf.worker.upstream_zone eq "example.com")
- Then take action: Block
Block all Worker subrequests except from your own zone
- When incoming requests match:
If you are using the expression editor:
(not cf.worker.upstream_zone in {"" "your-zone.com"})
- Then take action: Block
The empty string matches requests that did not come from a Worker, so this expression only blocks subrequests from other zones. Direct visitor traffic is not affected.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/waf/custom-rules/use-cases/block-worker-subrequests/#page","headline":"Block Worker subrequests from other zones","description":"Block or restrict Worker subrequests from other Cloudflare zones.","url":"https://developers.cloudflare.com/waf/custom-rules/use-cases/block-worker-subrequests/","inLanguage":"en","image":"https://developers.cloudflare.com/waf/custom-rules/use-cases/block-worker-subrequests/og.png?v=5caf44ada9087388","dateModified":"2026-10-05","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Challenge requests from bad bots with a managed challenge. title: Challenge bad bots image: https://developers.cloudflare.com/waf/custom-rules/use-cases/challenge-bad-bots/og.png?v=4016d7089931c80b
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/waf/llms.txt
Use this file to discover all available pages before exploring further.
Docs