Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

LL500's avatar
Level 1

Secure access to private assets via Cloudflare R2

Hi everyone,

I have started hosting my website's assets on Cloudflare R2. Everything is working well with a public bucket, and I have set up an address like cdn.mydomain.com.

But I also have private assets (images & videos) that should only be accessible to specific users of my app. I am looking for a solution to check directly from Cloudflare if a user is authorized to access the private assets. I understand that I need to use a Cloudflare worker, but I am unsure about which solution to use (cookie, token?)

I'm also thinking, if the user is authorized to access the private assets, load a page with let's say 10 assets, in that case the worker will receive 10 requests and check for each of them if the user is authorized? Is it the right way to do it?

Thanks!

0 likes
0 replies

Please or to participate in this conversation.