Cache everything with page rules

Hi! Could you please explain to me how exactly “Cache everything with page rules” works.

Let’s say i’ve set,* to:

Cache level: cache everything
Edge cache ttl: 2 weeks

Does this mean that html files also get cached for two weeks? If my website has “some text”, and I edit it today, will it take two weeks to refresh? How does this work exactly?


From the FAQ:

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.

You can use Cache-Control headers to prevent pages being cached by CF.
“private”,“no-cache”, or “max-age=0”

If you know that content on some of your HTML pages will change frequently, set this headers.

If you don’t update the pages frequently, a workaround can be to purge the cache manually after
you did your changes.

1 Like

Yes, Cloudflare literally caches everything if that rule is applied.

So your every webpage that matches that rule will be cached for 2 weeks.

If you are running a personal blog, it is a good idea to cache everything for 1 month and if you were to post a new post, you can tell Cloudflare to specifically purge the homepage so your viewers get the updated version.

If you’re using wordress I recommend the Comet Cache plugin, rather than using Cloudflare’s Cache Everything. You get a significant speed boost (up to 10x) while not having to worry about old content being cached after a textual edit.

OK, great responses. So the minimal time for the cache on the free plan is 2 hours yes?

That is correct!


Can i minimize this time with using; browser cache ttl - or does this setting do something different?

This is only for browsers. You can set the CF cache to 4 hours and advise the browser to cache the content locally for 2 hours for example.

After this 2 hours the browser will download the content from the Cloudflare cache.

Browser cache tells your visitor’s browser to cache the resources locally for x period. Once this time is up, the local cache expires and the next time the same visitor visits your site, it will request a fresh copy.

The main difference is that a user is able to clear the browser cache whereas the edge cache can only be cleared by the owner via Cloudflare interface/API.

I’ve posted my settings below. And also the headers.

The problem is that the cached html does not refresh after two hours. What am I doing wrong?

Request Method:GET
Status Code:200 OK
Remote Address:104.28…
Referrer Policy:no-referrer-when-downgrade
Cache-Control:public, max-age=7200
Content-Type:text/html; charset=UTF-8
Date:Sun, 18 Feb 2018 11:24:47 GMT
Expires:Sun, 18 Feb 2018 13:24:47 GMT
Accept-Encoding:gzip, deflate

I see it’s a HIT and the cache expire date is 2 hours after your visit. I think that’s the browser cache setting.

What makes you think the Edge cache isn’t refreshing? Did you make a change that’s not showing up?

Yeah, I’ve changed the html and it does not refresh.

In the cache tab in CF I have a very long cache time set, wouldn’t it have to be set to respect existing settings in order for page rules to work? But that would make all my images as such only be cached for two hours.

I always thought Edge Cache TTL is an independent setting and will override anything on your server. So I don’t know why your HTML isn’t refreshing. Especially considering that the headers show a 2-hour expiration.

I suggest you open a Support Ticket. Include the specific URL of the resource. It would probably also help if you included the cf-ray header from your first load, and the one 2 hours later that’s not refreshed.

Here’s the Support article on cache times:

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