WP Rocket Cloudflare - How to Use Them Together Without Conflicts (2026)
WP Rocket and Cloudflare work well together. Cloudflare speeds up delivery and protects your site at the network level, while WP Rocket caches and optimizes your pages on the server.
How WP Rocket and Cloudflare Fit Together
Cloudflare sits in front of your site at the DNS level. It caches static files like images, CSS and JavaScript at its edge, adds SSL and blocks malicious traffic.
WP Rocket runs on your server. It caches full HTML pages and optimizes CSS, JavaScript and media before anything reaches Cloudflare.
Because Cloudflare works at the DNS level, it's active as soon as your domain points to it. You don't add Cloudflare as a CDN URL in WP Rocket, and you don't strictly need any integration for the two to work.
Three Ways to Connect Them
| Setup | When to Use It | Cache Purging |
|---|---|---|
| No integration | Cloudflare caches static files only (default) | Static files update via cache-busting; purge Cloudflare manually when needed |
| WP Rocket's Cloudflare add-on | You want to manage a few Cloudflare settings and sync purges from WP Rocket | Synced when WP Rocket clears cache |
| Official Cloudflare plugin with APO | You want full-page edge caching | Synced automatically; WP Rocket enables auto-purge |
| Official plugin with Cache Rules | You cache HTML with Cloudflare Cache Rules | Official plugin required for sync |
Option 1: WP Rocket's Cloudflare Add-On
The add-on lives under Tools > Add-ons in WP Rocket. It needs your Cloudflare account email, Zone ID and Global API key. WP Rocket's docs say other Cloudflare API tokens aren't supported, and you can define the key in wp-config.php instead of the settings screen.
Once connected, it can:
- Purge Cloudflare's cache when you clear WP Rocket's cache.
- Toggle development mode, which temporarily bypasses Cloudflare's cache.
- Apply optimal settings: caching level set to Standard, Rocket Loader turned off and browser cache set to one year.
- Use relative protocol for static files, which you should only enable if you use Cloudflare's Flexible SSL.
If your host manages Cloudflare for you and doesn't share the API key, you can't use the add-on. That's the case with Cloudflare Enterprise on Cloudways, for example.
Option 2: Official Cloudflare Plugin and APO
Cloudflare's Automatic Platform Optimization (APO) caches your HTML pages at Cloudflare's edge, so visitors far from your server get pages much faster. It's a paid add-on on the free plan and included in higher plans.
WP Rocket is compatible with APO. When the official Cloudflare plugin is active and authenticated, WP Rocket's add-on is dimmed and WP Rocket enables auto-purge, so clearing WP Rocket's cache also clears APO's.
There's one thing to know: WP Rocket's docs note that using Purge Everything in Cloudflare's plugin doesn't clear WP Rocket's cache. Clear from WP Rocket when you want both cleared.
Cloudflare's own APO guide recommends turning off caching plugins when you first set up APO, confirming it works, then re-enabling them and testing. We'd follow that order.
Point your domain to Cloudflare
Change nameservers and confirm DNS records are proxied.
Install the official Cloudflare plugin
Connect it with an API token from your Cloudflare dashboard.
Enable APO
Purchase it if you're on the free plan, then turn it on in the plugin.
Re-enable and test WP Rocket
Clear WP Rocket's cache, then check pages logged out.
Verify APO
Check response headers for Cloudflare's cache status on HTML pages.
Option 3: Cache Rules and Cache Everything
Some setups cache HTML with Cloudflare Cache Rules instead of APO. WP Rocket's documentation says that with Cache Rules you must use the official Cloudflare plugin to keep caches in sync; with older Page Rules, either the add-on or the official plugin works.
Caching HTML at the edge without APO needs care. Logged-in users, carts, checkouts and account pages must bypass the edge cache, or visitors may see someone else's content.
Recommended Cloudflare Settings With WP Rocket
| Cloudflare Setting | Recommendation | Why |
|---|---|---|
| Rocket Loader | Off | WP Rocket's deferred and delayed JavaScript does this job; both together can break scripts |
| Caching level | Standard | Matches WP Rocket's optimal settings |
| Browser cache TTL | 1 year, or respect existing headers | Avoids browser caching warnings |
| Speed Brain | Off if using Preload Links | WP Rocket notes the two conflict |
| SSL mode | Full or Full (strict) | Avoids mixed content and redirect loops |
| Development mode | Only while troubleshooting | Bypasses Cloudflare's cache temporarily |
Avoiding Double Optimization
Cloudflare and WP Rocket both offer optimizations, so turn each one on in one place only:
- JavaScript loading: use WP Rocket's defer and delay, not Rocket Loader.
- Image optimization: use one service, either Cloudflare's paid image features or an image plugin.
- CDN: if Cloudflare is your CDN, don't also enable RocketCDN or another pull CDN for the same files.
Troubleshooting WP Rocket and Cloudflare
Changes don't appear
Clear WP Rocket's cache, then purge Cloudflare. With APO and the official plugin, clearing from WP Rocket purges both.
Broken scripts or layout
Turn off Rocket Loader first, then check WP Rocket's JavaScript settings.
Redirect loops
Usually an SSL mismatch. Set Cloudflare SSL to Full and make sure your site URL uses https.
Add-on won't connect
Use the Global API key, not a scoped API token, and check the Zone ID.
Logged-in content cached
Review Cache Rules so logged-in and cart pages bypass Cloudflare's HTML cache.
See clearing cache in WP Rocket and WP Rocket not working for more.
Cloudflare Free Plan vs APO: Is APO Worth It?
With WP Rocket on your server, Cloudflare's free plan already caches static files at the edge. APO adds edge caching for your HTML pages.
| Free Plan + WP Rocket | APO + WP Rocket | |
|---|---|---|
| Static files at the edge | Yes | Yes |
| HTML pages at the edge | No, served by your server's WP Rocket cache | Yes |
| TTFB for distant visitors | Depends on distance to your server | Usually lower |
| Extra cost | None | Paid add-on on the free plan |
| Complexity | Low | Moderate; needs the official plugin |
APO is most worthwhile when your audience is spread across continents and your TTFB is high for distant visitors. If most visitors are near your server, WP Rocket's page cache already serves pages quickly, and APO adds less. See reducing TTFB.
WP Rocket Cloudflare FAQ
Do I need the WP Rocket Cloudflare add-on?
Usually not. Cloudflare works once your DNS points to it. The add-on is a convenience for syncing purges and managing a few settings.
Is WP Rocket compatible with Cloudflare APO?
Yes. With the official Cloudflare plugin enabled and authenticated, cache clearing is synchronized.
Should I use Rocket Loader with WP Rocket?
No. WP Rocket's optimal Cloudflare settings turn Rocket Loader off, because WP Rocket handles JavaScript loading.
Can I use Cloudflare and RocketCDN together?
You can, but it's usually unnecessary. Pick one CDN for static files.