Hi Tom,
I just read your fantastic article on Adocasts, "Testing Cloudflare R2 for Video Storage," and wanted to say, great job. The solution you've outlined is really clever and I found the implementation very interesting.
I'm writing because I had a few follow-up questions, and I'd love it if you have a moment to elaborate on a couple of technical details:
Costs: Would it be possible to share any estimates on the costs you're seeing with this new setup? I'm especially interested in the comparison with what you were paying for Bunny Stream.
Worker Configuration: I'm fascinated by how you handled private access and caching. Could you share any more hints about the Cloudflare Worker's configuration? Any details on the logic you're applying would be a great help.
Cache Performance & Flow: How is the cache performing in practice? And more importantly, how are you applying it? Does the cache primarily operate between the worker and the end-user, or are you also using it to optimize requests between the worker and the R2 bucket?
And this brings me to my main question, which is about video protection vs. caching:
If each user needs to be authenticated to get a unique, authorized URL (similar to a presigned URL) to access a video, how do you manage to keep the Cloudflare cache effective? Traditionally, unique URLs aren't "cacheable." Did you have to make the R2 bucket public to get the cache to work, or did you find an ingenious way for the Worker to handle the user's authentication and still serve a cacheable response from Cloudflare's edge?
I totally understand if you're busy, but any insight you could share on that last point, in particular, would be incredibly helpful.
Again, congratulations on the article and thanks so much for sharing your knowledge.
Best,