Cloudflare R2 Workers Cache Api for Video files

I’m serving video over r2, however it’s a bit slow. I’d like to use the Cache API to cache fragmented mp4 files. Is that an acceptable use for the cache api?

I remember reading somewhere that Cloudflare’s cache can’t be used for video–but I’m hoping this doesn’t apply to the cache api when used in front of r2.

Yes, you can use the cache API with R2. See the supplemental terms: https://www.cloudflare.com/supplemental-terms/#cloudflare-developer-platform-cloudflare-workers-cloudflare-pages-workers-kv-durable-objects-and-r2

1 Like

I just received an official response from Cloudflare support user oshariff:

Using Cache to serve mp4 content is not recommended.
Your site and content will be hit with a ToS 2.8 violation, and be throttled.

I’m trying to dig further into what ToS 2.8 states.

It looks like they’re referring to 2.8 of the “Self-Serve Subscription Agreement” (I can’t include the link here because I don’t have permission–just google search and you’ll find it), which states generically that Cloudflare can only be used for html content. What’s the point of R2 for only html content…?

Something is off here. Either the support rep is wrong, or that legal document doesn’t apply, or Cloudflare needs to update it.

2.8. Use of the Services for serving video or a disproportionate percentage of pictures, audio files, or other non-HTML content is prohibited, unless purchased separately as part of a Paid Service or expressly allowed under our Supplemental Terms for a specific Service.

The supplemental terms allow serving any HTML or non-HTML content from KV, Durable Objects and R2.

Additionally:

4 Likes