concat() now supports up to 32 arguments
The concat() function in Cloudflare Rules now accepts up to 32 arguments instead of 16, enabling you to combine more request data directly in Rules expressions and simplify configurations that add dynamic headers and values to requests.
The concat() function in Cloudflare Rules now accepts up to 32 arguments, increased from 16. This allows you to build richer dynamic values directly in Rules expressions and simplify configurations that combine request data.
A common use case is adding a request header that sends context to your origin. The following Rulesets API request adds a Request Header Transform Rule to an existing http_request_late_transform phase ruleset. Its 18-argument expression combines request and network information into one header value:
curl --request POST \
"https://api.cloudflare.com/client/v4/zones/$ZONE_ID/rulesets/$RULESET_ID/rules" \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"ref": "add_request_context_header",
"description": "Add request context for the origin",
"expression": "true",
"action": "rewrite",
"action_parameters": {
"headers": {
"X-Request-Context": {
"operation": "set",
"expression": "concat(\"ip=\", to_string(ip.src), \";country=\", ip.src.country, \";host=\", http.host, \";method=\", http.request.method, \";path=\", http.request.uri.path, \";query=\", http.request.uri.query, \";ray-id=\", cf.ray_id, \";asn=\", to_string(ip.src.asnum), \";user-agent=\", http.user_agent)"
}
}
}
}'
For more information, refer to the concat() function reference and HTTP request header modification.
Source: original entry ↗
More from Cloudflare
Follow Cloudflare to get its new changes in your feed and email digest.
Cloudflare One Client for Windows - Hotfix for split tunnel disconnections
This release resolves an issue where the Windows Cloudflare One Client could repeatedly disconnect and reconnect when a split tunnel configuration with hostname-based entries failed to apply.
Cloudflare One Client for macOS - Split tunnel hostname fix
This hotfix resolves an issue where the Cloudflare One Client for macOS would repeatedly disconnect and reconnect when a split tunnel configuration with hostname-based entries failed to apply.
Cloudflare One Client for Linux - Split tunnel hostname configuration fix
Fixed an issue where the Linux client would repeatedly disconnect and reconnect when a split tunnel configuration with hostname-based entries failed to apply, improving stability for users with complex tunnel setups.