In short. A later Cloudflare response header rule cannot match a value changed by an earlier rule in the same phase.
Definition: No. Within one Cloudflare phase, a later response header transform rule evaluates its filter against the original response field values. The rule can still overwrite a header change made by an earlier rule when its own action runs.
Key facts
- Cloudflare's response header reference says response header transform rules manipulate headers sent to website visitors.
- Response header transform rules run in order, and a later rule can overwrite a change made by an earlier rule, according to Cloudflare's Transform Rules overview.
- Cloudflare's Rules documentation says request and response field values are immutable within each phase during rule evaluation.
- The
http.response.headersfield is a map of arrays of strings. Its keys are lowercase, and repeated headers appear in response order, as stated in Cloudflare's field reference.
What is evaluated inside the phase?
Cloudflare defines a phase as a stage in the request lifecycle where rulesets can execute. The phase definitions are controlled by Cloudflare. For a given request or response, the values of all request and response fields remain immutable while rules in that phase are evaluated. Field values can change between phases, so the phase boundary matters to any rule that reads a field.
Response Header Transform Rules use the http_response_headers_transform phase. Cloudflare's response header documentation states that later response header rules still use the original field values when evaluating their filter expressions, even when an earlier rule has changed a response header. The documentation also distinguishes this filter evaluation from the actions that modify the outgoing response.
What can a later rule change?
Transform Rules execute in their configured order. Cloudflare states that rules appearing later in the list can overwrite changes made by previous rules, and that rule order can be defined in the dashboard or through the API. This means a later rule can affect the final response header when its filter matches the phase's field snapshot, while its filter cannot match a value produced by an earlier rule in that same phase.
The response header reference lists the available operations. Set writes a literal or expression result, replacing the existing value or adding the header when it is absent. Add creates another value without removing existing headers with the same name. Remove deletes the response header. A later action therefore operates on the current response being built, even though the filter fields it reads retain their original values for the phase.
How is a response header field represented?
Cloudflare represents http.response.headers as Map<Array<String>>. Header names are converted to lowercase. When a response contains repeated headers, the array preserves the order in which those headers appear. Cloudflare documents that decoding is not performed and that whitespace and non-ASCII characters are preserved.
An expression in the field reference checks every value in the array for a match:
any(http.response.headers["server"][*] == "nginx")
The expression shows why a filter can inspect multiple values for one header name. For response header transforms, the values supplied to this kind of field expression are the original values for the phase, rather than a value assigned by an earlier response header transform rule in that phase.
How can a rule match be checked?
Cloudflare recommends Cloudflare Trace when troubleshooting Transform Rules. Its response header documentation says Trace can determine whether a rule triggers for a specific URL. A trace is therefore the documented place to inspect whether the rule filter matched while diagnosing an unexpected final header.
Related terms
- How do Cloudflare Set and Add response header operations differ?
- Do Cloudflare response header transformations change cache behavior?
- How does Cloudflare evaluate the order of custom WAF rules?
FAQ
Can a later response header rule read a value assigned by an earlier rule?
No. Within the same phase, the later rule evaluates response fields using their original values for that phase.
Can a later rule overwrite the earlier rule's response header change?
Yes. Cloudflare runs Transform Rules in order, and a later rule can overwrite a change made by an earlier rule when its action runs.
How do you write a filter for repeated response header values?
Use the documented map and array form, such as any(http.response.headers["server"][*] == "nginx"). Header names are lowercase in this field, and repeated values retain response order.
Sources
- Cloudflare, "Response Header Transform Rules", 4 September 2026
- Cloudflare, "Transform Rules", 14 August 2026
- Cloudflare, "Rules", 16 April 2026
- Cloudflare, "Phases", 16 April 2026
- Cloudflare, "http.response.headers", undated
Check how a page reads to answer engines. Open the GEO score analyzer