How to enable Cloudflare caching of images and css only (exclude .js files and admin area)

AI-generated summary

Enabling Cloudflare Caching for Images and CSS

haydenjames successfully enabled Cloudflare caching for images and CSS using page rules, excluding .js files and the admin area. After a month of testing, no issues were reported. The setup improved the site’s speed, as demonstrated on haydenjames’ forums.

Brandon007 expressed concerns about using Cloudflare optimizations, citing potential issues with the message-bus/ path being optimized. However, haydenjames reported no problems with the setup.

To ensure real IPs are displayed in the admin panel, haydenjames recommended adding a specific config, as outlined in the Meta Discourse post.

I used page rules. I’m still testing but will update this post with more details if I see no conflicts or issues after a month of using.

If this works, I plan to modify rules more extensively to cache only some of the .js files and exclude specific ones.

Edit: no issues thus far. You can get a feel for the speed by visiting the forums. Hosted with stacklinux.com (3.5GHz cores + NVMe @ 2G/s + 3GB memory).

@haydenjames looking back on this, how has it worked out?

Reading through the forums, it seems like a big no no to use Cloudflare optimizations. I know during install, I had to turn off orange cloud and roll with these settings:

forum.domain.com/*
Cache Level: Bypass, Disable Performance

I’ve left it that way, so I’m only using their DNS.

Looking at your screenshot, polling jumped out to me. It looks like your optimizations are going to allow Cloudflare to optimize “/message-bus/”, which from my reading can cause some issues. Just curious how this has all worked out.

I would like all the optimizations I can get, but not at the expense of headaches! :grinning_face_with_smiling_eyes:

It’s been working great. Sorry about the late reply. I was not active because I had no issues.

I should have mentioned you should also add this in config. So you will have real-ips in admin panel.