Tell Cloudflare to Cache Page via Cache Headers



Is it possible to use Cache headers to tell Cloudflare to cache something whilst sending no-cache across to clients? I’m aware I can use Page Rules for this but wondering if its something I can send from the origin?

My app currently sends these headers:

Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0

Which I’d like to retain and send onto the client requesting it.

Basically, something I can send that says “Cloudflare, you cache this for 30 days and send these cache headers across to clients”

ps: terrible title, sorry about that.

Cache-Control headers from origin not being respected for POST requests

So, you want your visitors to not cache something you’ve told CF to cache ?


Yep that’s exactly right.


So here’s how you tell Cloudflare what to cache:

I think this might be the relevant bit for your particular use case:

The third way to control Cloudflare caching behavior and browser caching behavior all in one go is by using the s-maxage Cache-Control header.

Normally we respect the max-age directive:

Cache-Control: max-age=1000
But if a customer would like to specify a cache timeout in the CDN which is different from the browser we can also use s-maxage:

Cache-Control: s-maxage=200, max-age=60


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