Cloudflare's APO with WP Rocket's minified CSS

Hey guys,

I have a website that uses WP Rocket, BunnyCDN, and Cloudflare APO.
Everything seems to be working fine except for one thing.

In WP Rocket, I have CSS minification enabled. This will convert the original CSS file paths to something like /wp-content/cache/min/…/filenameabcd1357.css. These files live on the CDN.

I’ve noticed that sometimes when visiting the site, the cached APO page is serving an outdated CSS filepath. So it’ll be trying to serve filenameabcd1357.css, which has since been dynamically changed by WP Rocket to filenameefgh2468.css.

This results in the file not being found, and no styling being loaded on the site.

Is there any way for APO to know when the CSS files have changed?

Thanks in advance!
Sunny

1 Like

Good question. I hope this improves.

Hi,

APO runs on the expectation that once the content is outdated Cloudflare for WordPress plugin will call Cache purge for the updated page. I assume WP Rocket does CSS minification with some delay, so by the time the new file starts to serve APO already cached html with outdated CSS file reference. The cleanest solution is to trigger Cache Purge once a new CSS file is produced. I assume that should be done from WP Rocket plugin.
Please comment in this thread Integrate with Cloudflare's new Automatic Platform Optimization · Issue #3180 · wp-media/wp-rocket · GitHub as APO integration is an open ticket in WP Rocket plugin.

1 Like

I guess WP Rocket should detect APO similar to Cache Everything Cloudflare - The admin bar is cached/Should I Use Cloudflare’s Cache Everything - WP Rocket Knowledge Base.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.

the issue with WP Rocket is fixed in version 3.8.6.

3 Likes