Custom HTTP Header

Use the Custom HTTP Header policy to route requests based on the custom HTTP headers specified for the outgoing message to the native service.

Example of a Custom HTTP Header policy:

kind: CustomHttpHeader
apiVersion: api.webmethods.io/beta
metadata:
  name: customHttpHeader
  version: 1.0
  namespace: sample
spec: 
  property:
    - key: ${request.path}
      value: test-value

To invoke the Custom HTTP Header policy, you can specify:

Type Description
kind

CustomHttpHeader. Defines the type of policy that is being configured.

apiVersion Denotes the version of the API in use.
metadata Denotes the metadata or details of the asset type.
It covers this metadata:
  • name. Name of the policy.
  • version. Version of the policy.
  • namespace. Namespace of the policy.
spec

You can configure the following policy specifications:

  • property. Define the custom HTTP headers to be added to the request.

    Configure the following:
    • key. Specifies the HTTP header key contained in the requests. For example, ${request.path}.
    • value. Specifies the Header value contained in the requests. As this property supports variable framework, you can use the available variables to specify the header value. For example, if you provide a header value as ${request.header.token1}, the header value in token1 is sent in the outgoing message to authenticate the backend services.