Skip to main content

Route By Header

Overview​

The Route By Header policy allows dynamic routing of incoming requests to different backend services based on specific HTTP header values. This policy is useful in multi-tenant or environment-based architectures where requests should be directed to different destinations depending on the context in the header (e.g., tenant ID, region, version).

Configuration Details​

FieldDescription
headersEnter the name(s) of the HTTP header(s) that will be used to extract routing values.
Example 1: ["key"]
Example 2: ["key1", "key2"]
hostEnter the target host for routing. You may use placeholder values based on the header values.
Example 1: www.google.com
Example 2: www.KEY.com
portSpecify the port of the destination server. Default is usually 80 (HTTP) or 443 (HTTPS).
protocolSpecify the protocol used for the connection. Must be http or https.
note

Cannot be changed: Toggle to prevent this policy from being removed.

Cannot change the setting value: Toggle to prevent changes to the configuration values after setup.

Example​

Given below header parameter:

headers: "env"

If a request includes the HTTP header:

env: staging

And the host field is configured as:

www._ENV_.mycompany.com

Then the request will be routed to below address over the defined port and protocol:

[www.staging.mycompany.com](http://www.staging.mycompany.com/)