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
Cyb3r-Jak3
Cyb3r-Jak35mo ago
What sort of auth are you looking for? Like sign in or IP based?
qwq6187
qwq61875mo ago
Sign @Cyb3r-Jok3
Cyb3r-Jak3
Cyb3r-Jak35mo ago
Best way will be to write a worker that has an R2 binding. You’ll handle the auth in the worker
qwq6187
qwq61875mo ago
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>?
Cyb3r-Jak3
Cyb3r-Jak35mo ago
You’d stream the file from the worker to the user
qwq6187
qwq61875mo ago
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?
Cyb3r-Jak3
Cyb3r-Jak35mo ago
Cloudflare doesn’t charge for egress unless on enterprise plan
qwq6187
qwq61875mo ago
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?)
qwq6187
qwq61875mo ago
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 […]
qwq6187
qwq61875mo ago
that looks like something that I need totally not straightforward xD
Hello, I’m Allie!
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.