Using cloudflare R2 with fly.dev subdomain

According to cloudflare’s R2 docs:

Public buckets can be set up in either one of two ways:

  • Expose your bucket as a custom domain under your control.
  • Expose your bucket as a Cloudflare-managed subdomain under https://r2.dev.

I’m using R2 for image uploads, and so I need my bucket to be public. However, I do not have a domain purchased, and therefore I cannot tell the registrar to point traffic to cloudflare. IIUC from other posts in this forum, it is possible to proxy traffic through cf for ddos protection and such, but I’m not sure if it it’s possible without having a domain to my name. The docs later mention that there are other restrictions:

  • The domain being used must belong to the same account as the R2 bucket.
  • Use of a domain with CNAME flattening enabled is not supported. You will need to disable CNAME flattening before enabling domain access.

I’m new to all of this DNS-networking-proxy-apparently-load-balancers-too stuff and so I’m extremely confused, any help would be greatly appreciated.

Get a cheap domain

Oh yeah it was definitely something I’d eventually do, I was just asking because I was curious but I guess there is no way around it? For the record this is more about using cloudflare + fly without a custom domain. It has little to do with R2 but I wanted to explain my use case

It might be easier to use Tigris instead since it’s integrated into Fly and has a CDN component.

I did look into tigris and I love how it sounds, seems really simple. However, I am trying to learn all this stuff and would rather stick to the tools I initially chose. Nothing against tigris of course, I just want to set up file uploads and learn a thing or two about dns in the process.

@Titongo If you want to stick with R2 then yep, you will need to comply with its restrictions. As you mention above you would either need to use their provided domain or use a custom domain that you control. You don’t control fly.dev and so can’t use that but if you buy a cheap domain for a few dollars, you do control that.

Understood, thanks for all the help!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.