Set HTTP header
The
set-header
policy assigns a value to an existing response and/or request header or adds a new response and/or request header.Inserts a list of HTTP headers into an HTTP message. When placed in an inbound pipeline, this policy sets the HTTP headers for the request being passed to the target service. When placed in an outbound pipeline, this policy sets the HTTP headers for the response being sent to the gateway’s client.
XML
<set-header name="header name" exists-action="override | skip | append | delete">
<value>value</value> <!--for multiple headers with the same name add additional value elements-->
</set-header>
XML
<set-header name="some header name" exists-action="override">
<value>20</value>
</set-header>
Multiple values of a header are concatenated to a CSV string, for example:
headerName: value1,value2,value3
Exceptions include standardized headers, which values:
- may contain commas (
User-Agent
,WWW-Authenticate
,Proxy-Authenticate
), - may contain date (
Cookie
,Set-Cookie
,Warning
), - contain date (
Date
,Expires
,If-Modified-Since
,If-Unmodified-Since
,Last-Modified
,Retry-After
).
In case of those exceptions, multiple header values will not be concatenated into one string and will be passed as separate headers, for example:
User-Agent: value1User-Agent: value2User-Agent: value3
Name | Description | Required |
set-header | Root element | Yes |
value | Specifies the value of the header to be set. For multiple headers with the same name add additional value elements. | Yes |
Name | Description | Required | Default |
exists-action | Specifies what action to take when the header is already specified. This attribute must have one of the following values:
| No | override |
name | Specifies name of the header to be set. | Yes | N/A |
This policy can be used in the inbound, outbound, and on-error policy scopes.
Questions?
We're always happy to help with any issues you might have!
Send us an email to [email protected] or request the demo with our sales team!
Last modified 3yr ago