Caching and page rule questions

I submitted a ticket on this, but I have waited 5 days with no response from CF. Different experts have give different responses, so if anyone can help I would be grateful


I am a novice with CF so thanks for your patience

Two further (simple I think) questions

ONE
I read “Cloudflare only caches based on file extension and doesn’t cache by MIME type. The Cloudflare CDN automatically caches files containing certain file extensions and doesn’t cache HTML by default

To mean
a Cloudflare only caches files - not the html rendered text or buttons, etc - from a page - those elements are ALWAYS fetched form the origin site even if 'cache everything 'is set ?

  • and no page specific rules are needed unless an image or other file present via that page is “dynamic”?

b So any dynamic content will not be cached - the only issue would be if an image or other file used on page was replace at the origin with different file with same file name? in that case we would need to purge that item?

c Example : A user’s account editing page would always show that user’s specific information even if that page is not excluded form caching using s page rule?

d I assume that if the same file name appears on different pages it is cached separately for each page - in case different files with the same name are used on different pages (unlikely perhaps but possible)?

Please confirm?

TWO

If want to set the caching level for an entire site do I need all 4 of these rules

cooperss.com/*
cooperss.com
www.cooperss.com/*
www.cooperss.com

or will just cooperss.com suffice?

Thanks!

a) Cloudflare caches by URL. In other words, items that shows up in the Network tab of your browser’s Dev Tools (F12 in Chrome). Static means a type of file that won’t change on a regular basis (JS/CSS/Images). Dynamic means a type of file that frequently change (HTML).

b) The list of extensions cached is here: Understanding Cloudflare's CDN – Cloudflare Help Center

c) An editing page is HTML, and Cloudflare won’t cache that by default. If you’re not prepared for the consequences of overriding Cloudflare’s default caching behavior, I advise against attempting to do so.

d) As I said, Cloudflare caches by URL. Your site shouldn’t return two different static files at the same URL. There are some specialized apps that do so, and devs on such a site know how to deal with that.

TWO: If you attempt to pursue messing with Cloudflare’s default caching configuration, a Page Rule that applies to an entire site is typically a match to *example.com/*
That will match www as well as blank, plus anything and everything (including blank) at the end.

1 Like

Thank you for the reply!
I think I get it.

But to make sure, please look at this page (link below). The photos rarely change but the html-rendered text and buttons can change at any time. As I understand it, unless specified otherwise via a rule, or origin-side restrictions on caching, CF will only cache the photos and the logos?

If a photo is updated without its file name changing (rarely happens) we should purge the cache for this page.

https://cooperss.com/assets?name=marine&id=1