Prevent caching of .css and .js

Hi all,

I’m setting up a couple of WooCommerce stores, only small to sell stuff I make. Anyhow, I’ve enabled Jetpack to act as a CDN for images (I haven’t populated the site yet, still testing the setup). It compresses them and serves them, freeing up bandwidth and resources. However, you cannot purge the cache. It seems the only way to update an image is to rename it. I’ve disabled every other module barring DDOS protection.

I know Cloudflare will provide DDOS protection. I know it won’t compress or convert images on the free plan, which is okay, I can do this. But I was thinking I’d rather use Cloudflare to cache much of my static content, but I’m aware it can break WooCommerce sites (without the cookie bypass feature in the paid plan).

I’ve researched the guides and found that .html files are not cached, but .cssand .js are. Looking through the list of cached files extensions I was wondering if disabling the caching of .css and .js is possible and if this would solve compatibility issues with WooCommerce. If it isn’t possible I’ll continue to use JetPack and if the site begins to pay for itself, upgrade to Cloudflare at a later date. I was wondering if the following rules would work:
Cache —> bypass
Cache —> bypass

And if this would fix compatibility with WooCommerce. Essentially, I serve html, css and js from my server and images and files, such as pdfs would be served via Cloudflare.


Cloudflare’s default caching configuration doesn’t break WooCommerce sites. As far as CSS and JS, those shouldn’t change and should be fine for caching. There are a lot of WooCommerce sites on Cloudflare and this is the first I’ve heard of a WC person wanting to bypass cache for JS and CSS.

1 Like

Thank you! I couldn’t find anything myself other than needing to bypass cookies if you cache html. I was told I needed to bypass various .css and .js files. Maybe that was more to do with minifying them.

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