Override HTTP Host headers
When your application needs specialized routing (CNAME
setup or custom hosts like Heroku), you can customize the Host
header used in health monitors on a per-endpoint or per-monitor level.
To balance traffic across multiple hosts, add Host
headers to individual endpoints within the same pool.
For example, you might have a pool with endpoints hosted in multiple AppEngine projects or Amazon S3 buckets. You also might want to set up specific failover endpoints within a pool.
Since these examples require specific hostnames per endpoint, your load balancer will not properly route traffic without a Host
header override.
If you need an endpoint Host
header override, add it when creating or editing a pool. For security reasons, this header must meet one of the following criteria:
- Is a subdomain of a zone associated with this account
- Matches the endpoint address
- Publicly resolves to the endpoint address
If you set a header override on an individual endpoint, it will take precedence over a header override set on a monitor during health monitor requests.
For example, you might have a load balancer for www.example.com
with the following setup:
-
Pools:
-
Pool 1:
- Endpoint 1 (
Host
header set tolb-app-a.example.com
) - Endpoint 2
- Endpoint 1 (
-
Pool 2:
- Endpoint 3
- Endpoint 4 (
Host
header set tolb-app-b.example.com
)
-
-
Monitor (
Host
header set towww.example.com
)
In this scenario, health monitor requests for Endpoint 1 would use lb-app-a.example.com
, health monitor requests for Endpoint 4 would use lb-app-b.example.com
, and all other health monitor requests would default to www.example.com
. For more information on updating your custom host configuration to be compatible with Cloudflare, see Configure Cloudflare and Heroku over HTTPS.
For a list of endpoints that override a monitor's Host
header:
- On a monitor, select Edit.
- Select Advanced health monitor settings.
- If you have endpoint overrides, you will see Endpoint host header overrides.