Error 1040 occurs when a Cloudflare Transform Rule (specifically an HTTP Request Header Modification rule) tries to set, remove, or modify a header that is reserved or protected. Cloudflare restricts modifications to certain headers to maintain security and protocol compliance. Headers like Host, Content-Length, and certain Cloudflare-internal headers (CF-* prefix) cannot be modified through Transform Rules.
The Transform Rule tries to set or remove a header like Host, Content-Length, Connection, or a CF-* internal header that Cloudflare protects from modification.
The rule targets hop-by-hop headers (Transfer-Encoding, Upgrade, Proxy-*) that are managed by the HTTP protocol layer and cannot be arbitrarily changed.
In Rules > Transform Rules > Modify Request Header, check which headers your rules are trying to change. Compare against Cloudflare's list of reserved headers.
If you need to pass custom data to your origin, use a custom header name (like X-Custom-Header) instead of trying to modify reserved headers.
Review the Transform Rules documentation for the complete list of headers that cannot be modified.
A Transform Rule set a request header to a value that is not valid per HTTP specifications.
A Cloudflare Transform Rule or rewrite produced an invalid URI path.
A Cloudflare Transform Rule's expression could not be evaluated at runtime.