Hi! I'm working an a tutorial app and have been looking for a solution to host probably a maximum o

Hi!

I'm working an a tutorial app and have been looking for a solution to host probably a maximum of around 1000-2000 video clips and serve them on a website. The videos are usually 10-20s long so can easily fit within ~5-10MB. I've been looking into R2 to avoid egress fees, but had difficulties figuring out how to do it securely so that someone can't just call my worker to request videos millions of times (since even if I add some authentication to the worker to avoid R2 requests, the worker invocation still incurs fees I think).

Then I ran across static assets. Am I missing anything or are these really the perfect solution for my use-case? The limits are 20k files and 25MiB individual size, which are above my requirements. And then the help page says there are never any request limits, so I'm totally safe and this remains free even if I expose the worker to a public URL? How does cloudflare know that my worker is returning a static asset and I shouldn't be charged (e.g. can the worker also do extra logic to determine whether to send the requested video or not)?
Was this page helpful?