Expose private bucket R2 file through Cloudflare
I need to expose private bucket R2 file through Cloudflare so that Cloudflare will also need authentication to access cached file. I have a specific case where we have private teams that are working on media content and synchronize all files with each other. That's where we would actually benefit from CDN. Guys from the team can be from Europe and USA and we want to distribute R2 content across the globe.
11 Replies
What sort of auth are you looking for? Like sign in or IP based?
Sign @Cyb3r-Jok3
Best way will be to write a worker that has an R2 binding. You’ll handle the auth in the worker
but I would need to transfer file firstly to worker and then from worker to the client
so it will be 80GB download for 40 GB file @Cyb3r-Jok3
there are no other ways>?
You’d stream the file from the worker to the user
yeah, and that means I'll first receive files to worker and then to the user
so that means X2 egress traffic
am I not right?
is there any article on that actually?
Cloudflare doesn’t charge for egress unless on enterprise plan
yeah I know. I am more about time for the end user. It will take X2 time to download the content - why do I need CDN then?)
Josh
Josh Wright
Signed S3 Custom, Secure Urls on CloudFlare - Josh Wright
It may sound contrived, but the signing a custom S3 URL which is secured through CloudFlare is a very common and unbelievably challenging process. If you’ve been pulling your hair out staring at cryptic AWS errors and CloudFlare timeouts, this might be your lucky day. Personally, I’ve worked through this issue several times – each […]
that looks like something that I need
totally not straightforward xD
It wouldn't take 2x as long, since you would have to go from datacenter -> R2 anyway, whether or not you are using a Worker.