Skip to content

gravitee-io/gravitee-policy-transformheaders

This branch is 1 commit ahead of master.

Folders and files

NameName
Last commit message
Last commit date
Oct 25, 2023
Jul 20, 2023
Nov 13, 2023
Dec 27, 2015
Jan 21, 2022
Nov 13, 2023
Jan 22, 2022
Dec 27, 2015
Jul 20, 2023
Dec 7, 2024
Oct 7, 2020

Repository files navigation

Transform headers policy

Gravitee.io License Releases CircleCI

Compatibility matrix

Plugin version APIM version

1.x

3.x

3.x

4.0 to latest

Phase

onRequest onResponse onRequestContent onResponseContent

X

X

X

X

Description

You can use the transformheaders policy to override HTTP headers in incoming requests or outbound responses. You can override the HTTP headers by:

  • Adding to or updating the list of headers

  • Removing headers individually

  • Defining a whitelist

Example

"transform-headers": {
    "addHeaders": [
        {
            "name": "X-Gravitee-Request-Id",
            "value": "{#request.id}"
        }
    ],
    "removeHeaders": [
        "X-Gravitee-TransactionId"
    ],
    "whitelistHeaders": [
        "Content-Type",
        "Content-Length"
    ],
    "scope": "REQUEST"
}

Add a header from the request’s payload:

"transform-headers": {
    "addHeaders": [
        {
            "name": "X-Product-Id",
            "value": "{#jsonPath(#request.content, '$.product.id')}"
        }
    ]
    "scope": "REQUEST_CONTENT"
}