Headers

Description

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

Usage

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

policies:
  - headers
  # other policies

Example

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

Options Reference

  • headerPrefix: 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