Caching with CMS Suggestions

So we host hundreds of clients who use our CMS to build, enhance, edit and maintain their websites.

Since implementing Cloudflare, we’ve been getting more and more complaints where a customer is confused because they’ll update a CSS stylesheet or upload a new PDF or change some underlying JS and they don’t see the change reflected immediately, which is a reasonble request for anyone who’s ever developed content of any type.

Just today I had to throw our Caching configuration into Development mode so that all caching would cease. (Edit: And just realized that it’s only for 3 hours…)

I can’t imagine that someone hasn’t dealt with this before. We can’t use page rules to solve this because we only have 125 and we have hundreds of customers so because of the reliance on routes that goes away same with using a worker to solve this.

Does anyone have any guidance or best practices?

What would be the ideal solution for us would be for us to be able to modify the list of default documents that Cloudflare caches and check off (turn off) caching for things like PDF, CSS or JS file types.

Thanks, appreciate any advice.

Tim

There are two things you can do, given you control the CMS.

Probably the easiest is to purge on publish. Whenever a document is updated on the CMS, issue a purge via the API for that document.

The more difficult is to use hash based names for the static assets, which might not suit your process. You end up with unique names for each edit like:

main.d587bbd6e38337f5accd.js
vendor.dc746a5db4ed650296e1.js

The file name is essentially a content related hash, change the content and the asset name changes also.

1 Like

Thanks Michael,
We’d initially considered the purge on publish option, but quickly decided against that in favor of a cache-busting approach that will likely be introduced in product in the near future.

I’m really looking for something I can immediately implement to mitigate the pain short term.

I made a configuration change to the Browser Cache TTL setting and changed it to ‘Respect Existing Headers’ so hopefully that will help alleviate some of the pain.

If you have any other suggestions/tips/tricks/potions etc, I’m all ears :slightly_smiling_face:

Thanks,

Tim

Finer grain CDN cache control via headers https://blog.cloudflare.com/cdn-cache-control/ :slight_smile:

1 Like

Thanks Eva :slight_smile: , will dive into that article now.

Appreciate it.

Tim