r/CloudFlare: What product to use to cache videos with cloudflare?

r/CloudFlare: What product to use to cache videos with cloudflare?
This article archives a conversation, which took place in a subreddit post (original source linked below) and to which I contributed a solution or answer (with the u/MasterofSynapse handle), in a Q&A format.

Original Reddit post: https://www.reddit.com/r/CloudFlare/comments/yggu87/what_product_to_use_to_cache_videos_with/



On my small community site I was serving videos that users uploaded.

Serving any videos through cloudflare has been banned after a post went viral on social media and my site got 2000% more visitors than usual in an hour. Fair enough that cloudflare don't like video. It seems like because of that spike I'll never be allowed to serve videos on my site again. I was trying to disable the cache for videos so that I'm charged via the origin server but it seems they're still blocked by cloudflare.

Looking at the solutions cloudfront offer - https://support.cloudflare.com/hc/en-us/articles/360057976851-Delivering-Videos-with-Cloudflare and they aren't really an option as it's user uploaded video.

Is there another service I can use to deliver the videos and have them cached so that not every request costs as it's mostly a couple of videos viewed a lot for 24 hours then rarely. As cloudfront will charge for each view I'm concerned that the cost will quickly.



Besides using Cloudflare Stream, which you could totally use if you program an upload interface for your users to commit to your Stream account and serve the videos from there, you would have to take any other service provider that is running their own CDN.

Many paid HTML5 players give you the option to do that, like the famous JWPlayer.

Or you go to any Public Cloud provider and pair an S3 bucket with a CDN by yourself.

But I don't know of a solution that is either entirely free or cheap.

Comment 1 on Answer

Thanks, Will look into R2. I'm not looking for it to be free or super cheap. But I'm concerned all the data cloudflare was caching for $20 a month now has a bill of 5000% times higher in AWS. I guess i really didn't realise how good I had it before!