top | item 26927887

(no title)

thitcanh | 4 years ago

Just as a side-note since their example uses CloudFlare: I think that host-rewriting is disabled on CloudFlare as a security or spam-avoidance feature.

If you want to have CF change the host to something else, like censored.com, this domain must also be part of your controlled domains, which means CF can’t be used for this purpose.

This at least was the case last time I looked into this (12 months ago)

It’s also possible that this feature is enabled for paying users, which I wasn’t.

discuss

order

luckylion|4 years ago

You can do it with a Worker, it'll do completely independent requests to the backend and you can then rewrite them (e.g. change headers, content) and relay them to the client.

VWWHFSfQ|4 years ago

I found this to be the case on CloudFront as well. As far as I can tell, it's not possible to direct the request to a different, custom origin based on the Host header. Only the URL path.

The recommendation is to use a Lambda@Edge worker to do it. I find this very annoying.

futhey|4 years ago

Some low-cost CDNs allow this, like BelugaCDN and BunnyCDN, probably others, with a web GUI for setup.