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?
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.