Skip to content
Cloudflare Docs

Add a request header for subrequests from other zones

Create a request header transform rule to add an HTTP header when the Workers subrequest comes from a different zone.

The following request header transform rule adds an HTTP header to Workers subrequests coming from a different zone:

Text in Expression Editor (replace myappexample.com with your domain):

(cf.worker.upstream_zone != "" and cf.worker.upstream_zone != "myappexample.com")

Selected operation under Modify request header: Set static

Header name: X-External-Workers-Subrequest

Value: 1

The cf.worker.upstream_zone field used in the rule expression is set to empty if the current request is not a Workers subrequest.