Are you looking to rewrite the Host header as the request gets passed to the origin (without changing the resolution of the origin)? Or something more like domain fronting?
An example or two would be great so I can share with the team.
Are you looking to rewrite the Host header as the request gets passed to the origin (without changing the resolution of the origin)? Or something more like domain fronting?
An example or two would be great so I can share with the team.
Example 1: A third-party service does not support custom domains, only responds to "Host: my-company.saas-helpdesk.com". For a clean user experience, I want "support.my-domain.com" to reverse proxy to "my-company.saas-helpdesk.com" while rewriting the Host header to their origin as "Host: my-company.saas-helpdesk.com". (I realize CSP headers and all sorts of pain might happen here - perhaps not the best example - but would be great flexibility to have around)
Example 2: My startup's origin only responds to "Host: beta.mydomain.com", and the developer with access to its code is on vacation. I want to release my product. I point "www.mydomain.com" to the IP hosting "beta.mydomain.com" but since that origin does not respond to "Host: www.mydomain.com" - it does not work. I need a Host header rewrite.
Thank you for your time!
What Workers does allow is for you to send a request to a different hostname. In this case, the Host header matches the DNS lookup. So if the third party is on Cloudflare, the request will go through their Cloudflare security settings.
It also allows, via the `resolveOverride` option, for you to do DNS lookup that doesn't match the Host header, as long as the Host header specifies a hostname within your domain. You can't forge a Host header specifying someone else's domain.