Skip to content

Latest commit

 

History

History
80 lines (64 loc) · 1.94 KB

README.adoc

File metadata and controls

80 lines (64 loc) · 1.94 KB

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"
}