APO Wordpress with WP Rocket

I was ready to install and activate the Automatic Platform Optimization for WordPress, but the documentation indicates that there may issues/conflicts with WP Rocket. I already have that installed and it seems to work well, so I’m hesitant to disable it or deactivate parts of it to accommodate the Cloudflare APO.

Does anyone have experience with this scenario? Is there a safe way to benefit from both?

Any insight is welcomed.

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

Hi @bill14. The issue with WP Rocket is discussed here: 404 issues on CSS & JS resources · Issue #3564 · wp-media/wp-rocket · GitHub. It is fixed in the latest version, so I think we will change our stand on the status of APO and WP Rocket integration. From my understanding it’s safe to use both. You will need to install Cloudflare Wordpress plugin and clear WP Rocket cache once APO is activated.
The ticket that tracks WP Rocket integration inside WP Rocket plugin is tracked here Enhancement - Integrate with Cloudflare's new Automatic Platform Optimization · Issue #3180 · wp-media/wp-rocket · GitHub

1 Like

It seems like we cannot run both the Cloudflare WP plugin and WP Rocket at the same time:

WP Rocket : The following plugins are not compatible with this plugin and may cause unexpected results:

  • Cloudflare - WP Rocket Cloudflare Add-on provides similar functionalities. They can not be active at the same time.

Please report this at “WpRocket” as thats what they state, not what Cloudflare is stating. Also this does not mean they are incompatible with each other is just means:

WP Rocket tells you they are not incompatible with each other

Thats a big difference

1 Like

I did a little more digging and discovered that it was referring to the Cloudflare APO and WP Rocket’s Cloudflare Add-On, so I simply disabled the Add-on

1 Like

that should work.

1 Like

I can confirm: WP Rocket + APO + Cloudflare’s WordPress plugin works very nicely for me. I don’t have to babysit it to check if CSS/fonts/anything is broken.

(Don’t use the WP Rocket Cloudflare addon though, like you said, until the WP Rocket team releases an update.)

3 Likes

I’m pretty sure it’s not 100% compatible. For example the two cache layers never sync up in my experience. There are some dynamic aspects of my site (eg pages that load in new posts, price update widgets) and I have wp rocket set to clear cache every 9 hours, but Cloudflare APO does not obey this rule and will not clear also - leaving the cache layers out of sync. Any one know how to resolve this??

If you set WP Rockets TTL to 9 hours, WP Rocket shall send a clear cache command to Cloudflare, if thats made it works perfectly fine. If you rebuild cache in the backend and do not tell Cloudflare you do not give Cloudflare a chance to by in sync. With APO this anyway should not create any problem AFAIK.

It does though. I have the exact same problem as @email11. WP Rocket rebuilds the page cache every 8 hours but that does not trigger APO to clear. I have tried to recreate the cache clearance with a page rule Edge TTL also 8 hours but that doesn’t seem to work.

My dynamic change is a changing of the order of sidebar widgets so I can easily tell whether it worked or not. If I do a manual cache purge it works. But nothing else does. A post change or comment purges both caches.

Unless the plugins are linked or I can set an automatic “clear all caches” on CF every x hours it doesn’t work.

1 Like

I’m still waiting for this to work…

Did you find a workaround? Is there a way to automatically programme a CF full cahce purge every x hours? Other than that we have to manually press the button. I am also not clear why the Edge page rule does not work. I had the suspicion it might be tiered caching, i.e. the Edge doesn’t go back to the origin but takes the same page from another CF edge. But switching off tiered cache didn’t seem to do much either…

I have a series of posts that I need for the cache to clear the most when I publish a new post. These include various feed pages like custom built category pages that pull in posts based on tags+category pairings. I have a list of these pages that I make sure WP rocket clears whenever I publish a new post (thats found in Advanced Rules → Always Purge URL(s)). I then paste those same URL’s into the Cloudflare custom cache purge urls - and clear those URLS.

Yes, I have various dynamic sidebars in my posts too which would greatly benefit from a proper automatic purge every 9 hours (like it should do when WP-Rocket sends the command). I also have other widgets like price comparisons that need updating all over my site but sadly I’m having to make do with just purging those most important pages on a new post publish, and then manually purging my whole Cloudflare cache every week or so.

I cant believe this connection between WP Rocket and Cloudflare APO still hasn’t been fixed.

Have you tried making a request to Cloudflare’s API every 8 hours with a cronjob or a Postman monitor?

curl -L -X DELETE "https://api.cloudflare.com/client/v4/zones/CLOUDFLARE_ZONE_ID/purge_cache" \
-H "X-Auth-Email: CLOUDFLARE_EMAIL" \
-H "X-Auth-Key: CLOUDFLARE_API_KEY" \
-H "Content-Type: application/json" \
--data-raw "{
    \"files\": [
        \"https://example.com/\",
        \"https://example.com/page-1/\",
        \"https://example.com/page-2/\"
    ]
}"

If you want to purge everything:

--data-raw "{
    \"purge_everything\":true
}"

More:
https://api.cloudflare.com/#zone-purge-all-files

Leading on from this. How can we just get Cloudflare to clear page html cache - obviously id much rather not clear the whole cache everytime a new post is created, as all images should ideally stay in the cache.