best way to server many assets to a client account from r2?

Hey all 👋 , In my app, each client has their own media library, and the media library is stored in a private R2 bucket. In every request, a URL will be constructed on the image tag or the video tag that will hit a worker. The worker will check if the user is authenticated, and if yes, it will send the object back. This is currently working, but I wonder if this is the best way to do things. Basically, on every refresh for every client for every object we are hitting that endpoint as well as reading from R2. I wanted to know what is the most common or best practice approach here. I was thinking, if I use a pre-signed URL and send that when the object gets created, and cache the pre-signed URL for some time, then at least it will hit the object directly. On every refresh, we wouldn't get hit, and the worker and the object don't have to re-work. But I'm not sure if that's the best way or if there's a better alternative. love to hear from anyone that came across similar scenarios
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?