Files cached by cloudflare

You could limit the upload size on your website to limit file size, but CF has its own file size cache limit:

1 Like

There is no max size you can decide, at least Cloudflare side, they allow max 512MB, all bigger sizes are simply passed through.

If you want to limit file size you can do so at the origin using cache-control headers.

Can I increase the 512MB to a size that I want? As 2GB?

How do I have to edit the page rules to do it?


There isn’t a way to do that apart from buying the Enterprise plan… The limit is 512MB for everyone!

And how can I decide to cache only mp4, mkv, zip and rar file extensions in the rule I attached in 17th post?


You need to simply put the file extension at the end, but I sincerely don’t know (would love to know) if there is a way to do so in a single page rule or if you need to create 4 of them.

The alternative way would be to issue the correct cache-control headers from the origin and make Cloudflare respect those.

Can I set those three page rule settings in 17th post as http response headers from my origin?


Cache level no, you must set a page rule, but the others of course. They are basic Cache-Control headers.

So can I set only Cache level = Cache everything in page rule, and from my origin can I set browser cache ttl and edge cache ttl response header to instruct Cloudflare what has it to do?


Yes, they are not called like that, check the page and there is all the info you need to best configure your origin. You should look specifically to max-age and s-maxage, but it’s not limited to that.

1 Like

Can I instruct my origin to give two “Cache control” response headers?

I thought (in my origin):
Cache-Control: max-age=86400
Cache-Control: s-maxage=2592000

And in page rule:
Cache level: cache everything

So in case of dynamic php page my origin can give a cache-control with 10 seconds, in case of a media (video, music, image) my origin can give 1 month of time catching.

Is it possible to do this?


I know nothing about PHP, the only thing I can tell you is that you should combine all Cache-Control headers in a single Header just like they do in the link I posted.

What you are saying is possible, I am sure. Don’t know how to implement in though in your origin.

See the docs on cache-control

If you want to specify multiple, you can separate them with a comma space

Cache-Control: public, max-age=86400, s-maxage=2592000
1 Like

If I do so:

static files - my origin
Cache-Control: public, max-age=86400, s-maxage=2592000

dynamic files - my origin
Cache-Control: public, max-age=1, s-maxage=2

page rule
Cache level: cache everything

I can cache on Cloudflare only static files? It will work?



This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.