How do I use Cache Everything with Cloudflare?

By default Cloudflare is conservative with caching and only caches specific static file types omitting HTML and other resources that may also be static for some users. You can get maximum performance from Cloudflare and cache other non-static file extensions by using Page Rules.

Go to Cloudflare.com > Choose your domain (upper left hand side) > Page Rules > Create Page Rule.


CAUTION: Cache-everything means all visitors will receive the cached asset therefore we do not recommend setting this on assets requiring authentication or other dynamic dependencies.

 

 

 

Screenshot_from_2017-05-08_17-18-58.png

 

Now you can set the URL to match for instance: "www.example.com/*". The asterisk (*) is a wildcard character that can match any characters including no characters. For example, once implemented this rule would apply caching to https://www.example.com/index.html.

 

Screenshot_from_2017-05-10_12-48-31.png

Next after adding the "Cache Level" setting choose "Cache Everything"

 

Screenshot_from_2017-05-10_12-47-18.png

Once setup all resources matching the "Cache Everything" Rule will be cached by Cloudflare. You can find out more about setting up Page Rules in our Page Rules Tutorial.

You can verify your "Cache Everything" rule is working by following this guide on How to tell if Cloudflare is caching an asset.

We do offer more advanced caching configurations with Enterprise plans which have access to "Bypass cache on cookie" and "Custom Cache Keys" features to facilitate more granular control of caching. 

 

It's important to note that Cloudflare will still respect Origin caching directive with this Page Rule in effect. 

Cache-Control headers sending "private","no-cache", or "max-age=0" or Expires header with a date in the past will override the rule and cause Cloudflare to NOT cache the resource. To override these you'd need to add another setting called "Edge Cache TTL" and set it to however long you'd like Cloudflare to cache that resource on our servers.

 

Still not finding what you need?

The Cloudflare team is here to help. 95% of questions can be answered using the search tool, but if you can’t find what you need, submit a support request.

Powered by Zendesk