Inconsistant CF-Cache Status, not all resources cached

I have had my site set up on cloudflare for a few days now just to wait for any registrar changes to take place and what not, and am now seeing that the CDN appears to be working, my JS, HTML, & CSS are being minifed, SVG’s and what not being brotli compressed.

Although I have the following enabled:

  • Browser Cache TTL 8 Days under Caching > Config
  • Added a page rule for “mysite.com” with the following settings:
    Browser Cache TTL: 8 days, Cache Level: Cache Everything, Edge Cache TTL: 7 days

Yet, even with this enabled- one of the pieces of my site, a background video webm/mp4 is never cached, and chrome dev tools and page insights both report that I am not using an efficient cache policy (yet it shows the 8 days). GT Metrix and PageSpeedTest however both say I am, most of the time, except for that single background video. Have I set something up incorrectly?

As I recall, they seem to want 30 day cache for static files.

If you can post a screenshot of the Page Rule(s) and the URL of page with the uncached mp4, we can take a look.

1 Like

Ah I see, should it be the edge cache TTL or just the cache TTL I set to 30 days, or both?

Plain old (Browser) Cache TTL. But it’s clearly showing 8 days, even when I query logo.png.

You haven’t posted a screenshot of your Page Rules, but it doesn’t seem they’re properly set.

1 Like

I’ll adjust the setting in the page rule and through the non page rule method (Caching > Config) to 30 days for cache TTL. (Does the setting in Caching section do the same as setting a Browser Cache TTL page rule?)

Oohhhhh…your site has a ‘www’ in front. Your Page Rule needs that as well.

1 Like

Ah, ok, I will set that now- I’ve added another question to my post above as well.

I’ve set it to www. now. Do I also need to do the * thing as well before the www?

No, it’s good now. Even the background video shows HIT.

What was that other question? Was it the “Which cache for 30 days”? That’s up to you.

Edge Cache generally purges out early due to lack of use. Your site looks pretty static (no user logins, data, etc). I’d set the Edge Cache really high, as you can always purge your Cloudflare Cache if needed.

Browser cache is trickier. I suggest you get rid of the Browser Cache setting in the Page Rule, as that over-applies (to Everything). You don’t want browsers caching the HTML for 30 days if you change content (you can purge your visitors’ browser caches). So use the regular Cache setting in the Cloudflare Dashboard to set a 30-day cache. That won’t apply to html – just the static files that Pagespeed Insights is testing.

1 Like

Ah, I see, thank you. I checked my end and all seems to be working- 31 days still threw errors, so I set it to 2 months. Sorry if this is outside of the scope of the question, but I tried to search this before and couldn’t find an easy to understand answer. But what is the difference between edge cache and just normal browser cache? Which can be purged by pressing ctrl f5, and which can be purged through the dashboard? And why can one be set longer than another? It seems whenever I pushed an update or change, pressing ctrl f5 did the trick.

Edge Cache is on a Cloudflare server. You can only purge it via the Cloudflare Dashboard.

Normal browser cache is on your computer. You can only purge it from your computer (ctrl-F5, I suppose).

Cloudflare doesn’t cache HTML by default, which probably why F5 was working. Now, I don’t expect to with that Cache Everything page rule.

1 Like

Thank you, I understand now. All seems to be working now! Thanks for the help!

1 Like

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