#host header
17 messages · Page 1 of 1 (latest)
If you're using Cloudflare's Load Balancer you can override the host header of a specfic per Origin in a Pool even without Enterprise: https://developers.cloudflare.com/load-balancing/additional-options/override-http-host-headers/
There's more restrictions on it though:
For security reasons, this header must meet one of the following criteria:
Is a subdomain of a zone associated with this account Matches the origin address Publicly resolves to the origin address
It's under Manage Pools -> Edit, and then the Origins settings
(forgot to use reply, @inland mauve )
hmm R2 is special because it uses CF for SaaS under it, lots of special Cloudflare magic making it work, not a normal origin
You could try though. I believe Pages does work if you override it to the pages.dev, R2 might work as well, not something I've tried
I would use whatever you have added in the R2 Custom Domains tab
if it's asiacdn you could try overriding it to that
(I'm assuming this is an R2 Custom Domain and not a Worker)
hmm yea I don't think you'll be able to get this working with R2 Custom Domains.
With Cloudflare Pages (which I'm using as an example because it's also a Cloudflare product using CF for SaaS under the hood, although with slightly different magic) you can override the Host header to the real pages.dev url and it accepts it (I think because same account or something), but R2 isn't setup like that/the same way. The CNAMEs technically go to public.r2.dev but it won't accept that
Under the hood this is all CF for SaaS magic, the R2 Custom Domain has what you could think of an allowlist for specific host headers, LB is too late though or something, and it just doesn't work
I know people have accomplished this before just using Workers -- either to just route and fetch the r2 custom domain, or with the R2 Binding. When Snippets come out it would be cheaper/wouldn't have to pay for Worker Invocations.
If you have control over the client (like downloading via JS, or from a program), you could just do the routing client-side
Yea.. see my comment above, I don't think you'll be able to use LB for this
delete the LB entirely (if it exists on that hostname) and any record, and then add it via the R2 Custom Domain tab of the bucket
and you'll also want to give it a second to work
I should probably clarify as well "CF for SaaS" is Cloudflare for SaaS (https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/), a Cloudflare product which would allow you to have your Customers point their domains at your Cloudflare domain, and have Cloudflare handle SSL and routing. Cloudflare for SaaS is used internally by various Cloudflare products to enable you to use your own domain with them. It works pretty well but it has interesting quirks like it not playing nicely with LB, and overriding some settings like min tls. Technically requests go through both your website and also the R2 Domain (which is a separate website/zone with its own settings)