Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ To create a rule:
:::

8. For **Modify response header**, select one of the following operations:

- _Add static_ — Adds an HTTP response header with a static string value. This operation will not remove any existing response headers with the same name.
- _Add dynamic_ — Adds an HTTP response header according to the provided expression. This operation will not remove any existing response headers with the same name.
- _Set static_ — Sets the value of an HTTP response header to a static string value. Overrides the value of any existing headers with the same name or adds a new header if it does not exist.
- _Set dynamic_ — Sets the value of an HTTP response header according to the provided expression. Overrides the value of any existing headers with the same name or adds a new header if it does not exist.
- _Add_ — Adds an HTTP response header with a static string value. This operation will not remove any existing response headers with the same name.
- _Remove_ — Removes the HTTP response header with the provided name, if it exists.

9. Enter the name of the HTTP response header to modify in **Header name** and the static value or expression in **Value**, if you are setting the header value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Through Response Header Transform Rules you can:
- Set the value of an HTTP response header to a literal string value, overwriting its previous value or adding a new header to the response if it does not exist.
- Set the value of an HTTP response header according to an expression, overwriting its previous value or adding a new header to the response if it does not exist.
- Add a new HTTP response header with a literal string value without removing any existing headers with the same name.
- Add a new HTTP response header according to an expression without removing any existing headers with the same name.
- Remove an HTTP header from the response.

You can create a response header transform rule [in the dashboard](/rules/transform/response-header-modification/create-dashboard/), [via API](/rules/transform/response-header-modification/create-api/), or [using Terraform](/terraform/additional-configurations/transform-rules/#create-a-response-header-transform-rule).
Expand Down Expand Up @@ -69,8 +70,6 @@ You can create a response header transform rule [in the dashboard](/rules/transf

- To add a `set-cookie` header to the response, make sure you use the _Add_ operation instead of _Set static_/_Set dynamic_. Using one of the _Set_ operations will remove any `set-cookie` headers already in the response, including those added by other Cloudflare products such as Bot Management.

- Currently you can only use the _Add_ operation with a literal string value.

<Render
file="troubleshoot-rules-with-trace"
params={{ rulesFeatureName: "Response Header Transform Rules" }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ To set an HTTP response header, overwriting any headers with the same name, use

- **operation**: `set`
- Include one of the following parameters to define a static or dynamic value:

- **value**: Specifies a static value for the HTTP response header.
- **expression**: Specifies the expression that defines a value for the HTTP response header.

To add an HTTP response header, keeping any existing headers with the same name, use the following parameters in the `action_parameters` field:

- **operation**: `add`
- **value**: Specifies a static value for the HTTP response header.
- Include one of the following parameters to define a static or dynamic value:
- **value**: Specifies a static value for the HTTP response header.
- **expression**: Specifies the expression that defines a value for the HTTP response header.

To remove an HTTP response header, set the following parameter in the `action_parameters` field:

Expand Down Expand Up @@ -48,7 +49,7 @@ The full syntax of the `action_parameters` field to define a dynamic HTTP respon
"action_parameters": {
"headers": {
"<HEADER_NAME>": {
"operation": "set",
"operation": "<set|add>",
"expression": "<EXPRESSION>"
}
}
Expand Down