HeaderFilter — remove and add headers
Removes headers from and adds headers to a message. Headers are added to any existing headers in the message. To replace, remove the header and add it.
{
"name": string,
"type": "HeaderFilter",
"config": {
"messageType": string,
"remove": [ string, ... ],
"add": {
name: [ string, ... ], ...
}
}
}"messageType": string,
requiredIndicates the type of message in the exchange to filter headers for.
Must be one of: "REQUEST",
"RESPONSE".
"remove": array of strings,
optionalThe names of header fields to remove from the message.
"add": object, optionalHeader fields to add to the message. The name
specifies the header name, with an associated array of string
values.
Replace the host header on the incoming request with
myhost.com:
{
"name": "ReplaceHostFilter",
"type": "HeaderFilter",
"config": {
"messageType": "REQUEST",
"remove": [ "host" ],
"add": {
"host": [ "myhost.com" ]
}
}
}Add a Set-Cookie header in the response:
{
"name": "SetCookieFilter",
"type": "HeaderFilter",
"config": {
"messageType": "RESPONSE",
"add": {
"Set-Cookie": [ "mysession=12345" ]
}
}
}Add headers custom1 and custom2
to the request:
{
"name": "SetCustomHeaders",
"type": "HeaderFilter",
"config": {
"messageType": "RESQUEST",
"add": {
"custom1": [ "12345", "6789" ],
"custom2": [ "abcd" ]
}
}
}