How to Override a Page Rule Edge Cache TLL

We have a scenario where we would like to override an Edge Cache TTL set by a page rule. Is there a way to do this with an origin response header or no? From documentation is looks like CF will always override if it s set via page rule.

We have an Edge Cache TTL defined in a page rule for a specific directory on the site. There is dynamic code that does cache version validation to ensure a stale resource file does not get cached by CFs Edge if the cache validation fails. The validation is needed because we have had issues with bots requesting a page from one server and then requesting resource files from another because they don’t respect our sticky session cookie during our deployments. There are other ways to solve this but this is the path we’re on right now.

We also could set the cache-control max-age in code and disable the edge caching , but we’d prefer to keep it as a CF page rule for simplicity as we have other static resources in the directory that we want cached. Alternatively if there is not a way to override we will look at multiple page rules and not set the edge cache for nested dynamic content.


I believe you can also set s-maxage instead of Edge Cache TTL. Also, Cloudflare just launched some CDN-specific cache-control directives: CDN-Cache-Control: Precision Control for your CDN(s)

Static assets are cached by Cloudflare by default, as long as they have standard filename extensions.

You may want to review this article about Origin Cache-Control:

1 Like

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