Get origin hostname on origin when content is retrieved


I am wondering if the following is possible. We serve a multi-tenant site that selects the correct tenant based on the host subdomain name (e.g. might be customer1 and might be customer2).

We were hoping to use DNS to enable us to serve from, e.g. and from to support vanity domains. We have setup the CNAMES in DNS correctly, but there doesn’t seem to be a way to get the host name of the origin server when the cloudflare proxy retrieves from the origin. When a user visits (which has a CNAME that points to, we would like the origin site hosted at to know what origin host name origin was mapped in DNS (i.e. we would like to be able to get the value when someone visits

Is this scenario possible or supported or is there perhaps something obvious that I’m missing?



Is there a header or some other way we can get hold of the mapped origin host name from the origin server?

:wave: @gavind,

Allowing an arbitrary hostname to cname to a domain you control is a feature of Cloudflare’s SSL for SaaS product.

This is an optional (extra) feature for the SSL for SaaS platform. When you provision the custom hostname you can include additional metadata (via API only) and that information is then accessible to a worker. I believe you may also be able to rewrite the host header to the value of the CNAME target (assuming it is in your proxy zone) as well if that would be easier.

If you contact the Cloudflare sales team, one of their solutions engineers might be able to provide better information/context than a random pug on the interwebs.

– OG