Cloudflare Docs
Rules
Rules
Edit this page
Give us feedback
Set theme to dark (⇧+D)

Request header modification examples

The following examples illustrate how to perform request header modifications with Transform Rules:

​​ Add an HTTP request header with a static value

The following HTTP request header modification rule adds a header named X-Source with a static value (Cloudflare) to the request:

Text in Expression Editor:

starts_with(http.request.uri.path, "/en/")

Selected operation under Modify request header: Set static

Header name: X-Source

Value: Cloudflare

​​ Add an HTTP request header with the current bot score

The following HTTP request header modification rule adds a header named X-Bot-Score with the current bot score to the request:

Text in Expression Editor:

starts_with(http.request.uri.path, "/en/")

Selected operation under Modify request header: Set dynamic

Header name: X-Bot-Score

Value: to_string(cf.bot_management.score)

​​ Remove an HTTP request header

The following HTTP request header modification rule removes the cf-connecting-ip header from the request:

Text in Expression Editor:

starts_with(http.request.uri.path, "/private/")

Selected operation under Modify request header: Remove

Header name: cf-connecting-ip