Tyk v2.2 Documentation Components

  1. Home
  2. Tyk v2.2 Documentation Components
  3. Request Headers: Context Variables

Request Headers: Context Variables

As of version 2.2 Tyk allows context variables to be injected into headers using the $tyk_context. namespace.

To enable context variables, you must first enable them in your API Definition.

The context variables that are available are:

  • request_data: If the inbound request contained any query data or form data, it will be available in this object, for the header injector, Tyk will format this data as key:value1,value2,valueN;key:value1,value2 etc.
  • path_parts: The components of the path, split on /, these values are made available in the format of a comma delimited list.
  • token: The inbound raw token (if bearer tokens are being used) of this user.
  • path: The path that is being requested.
  • remote_addr: The IP address of the connecting client.
  • $jwt_claims_CLAIMNAME – If JWT tokens are being used (not OIDC Middleware), then each claim in the JWT is available in this format to the context processor.