Caching HLS fragments (video) as .PNG (Violates Policy?)


The way I understand it is CF caches HTML/CSS and JS files only, as well image files such as PNG.

AFAIK, CF doesn’t cache any arbitrary file but only those with extensions it recognizes.

But I have an application that generates HLS video fragments and a playlist for HLS players which must not be cached. The fragments would benefit from being cached. But since CF doesn’t cache arbitrary files, I thought what if I change the fragments to have a .png extension. But I don’t want to do this sneakily or violate the CF policy.

I just want to be able to cache the HLS or DASH video fragments on the edge to reduce bandwidth on the origin, and AFAIK CF only allows that for Enterprise users under the Stream service, but that doesn’t seem to be a solution I use since my origin server is generating the HLS from my RTMP stream and CF is not capable of taking an RTMP stream (maybe CF will have such ability soon, but not now)

So my question is would I be violating the CF policy if I play a trick like the one I described where I change the extension name of each video fragment to PNG?

Please note that my goal is to understand how I can solve the problem of caching HLS on the edge. I do not intent to violate any CF policy on what can be cached.

Thanks in advance.

The policy isn’t about caching. It’s about burdening the Cloudflare network with media files. If these media files aren’t part of your general website content, then it would be a problem if it generates a huge amount of traffic. How much monthly bandwidth is this?

And if you’re going to try to be sneaky with file extensions, Cloudflare isn’t going to notice either way until it generates too much traffic. You may as well just add a Page Rule to match *.hls (or whatever) with a Cache Everything setting.

This topic was automatically closed after 14 days. New replies are no longer allowed.