Documentation

Policies Reference

Headers (deprecated)

Note: This policy has been superseded by the Request Transformer and might be removed in a future version of Express Gateway.

Description

The Headers policy allows you to forward arbitrary values from the gateway as headers in the response object.

Usage

To enable the Headers policy, add headers in gateway.config.yml in the policies section.

policies:
  - headers
  # other policies

Example

pipelines:
  api:
    policies:
      -
        headers:
          - action:
              headersPrefix: 'eg-'
              forwardHeaders:
                id: 'consumer.id'
                consumer-name: 'consumer.name'
                consumer-type: 'consumer.type'
                requestID: 'requestID'
                scopes: 'consumer.token.scopes'

Options Reference

  • headersPrefix: String with prefix to be added for each header. Defaults to empty string ''
  • forwardHeaders: Object with header name and an expression that’s catching the value