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

Illustration for Three Ways to Connect Them on the WP Rocket Cloudflare page, showing a globe diagram
Choosing your WP Rocket and Cloudflare setup
SetupWhen to Use ItCache Purging
No integrationCloudflare caches static files only (default)Static files update via cache-busting; purge Cloudflare manually when needed
WP Rocket's Cloudflare add-onYou want to manage a few Cloudflare settings and sync purges from WP RocketSynced when WP Rocket clears cache
Official Cloudflare plugin with APOYou want full-page edge cachingSynced automatically; WP Rocket enables auto-purge
Official plugin with Cache RulesYou cache HTML with Cloudflare Cache RulesOfficial 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:

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.

  1. Point your domain to Cloudflare

    Change nameservers and confirm DNS records are proxied.

  2. Install the official Cloudflare plugin

    Connect it with an API token from your Cloudflare dashboard.

  3. Enable APO

    Purchase it if you're on the free plan, then turn it on in the plugin.

  4. Re-enable and test WP Rocket

    Clear WP Rocket's cache, then check pages logged out.

  5. Verify APO

    Check response headers for Cloudflare's cache status on HTML pages.

Option 3: Cache Rules and Cache Everything

Illustration for Option 3: Cache Rules and Cache Everything on the WP Rocket Cloudflare page, showing a globe diagram

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.

Cloudflare settings to check
Cloudflare SettingRecommendationWhy
Rocket LoaderOffWP Rocket's deferred and delayed JavaScript does this job; both together can break scripts
Caching levelStandardMatches WP Rocket's optimal settings
Browser cache TTL1 year, or respect existing headersAvoids browser caching warnings
Speed BrainOff if using Preload LinksWP Rocket notes the two conflict
SSL modeFull or Full (strict)Avoids mixed content and redirect loops
Development modeOnly while troubleshootingBypasses Cloudflare's cache temporarily

Avoiding Double Optimization

Cloudflare and WP Rocket both offer optimizations, so turn each one on in one place only:

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.

Cloudflare free plan vs adding APO
Free Plan + WP RocketAPO + WP Rocket
Static files at the edgeYesYes
HTML pages at the edgeNo, served by your server's WP Rocket cacheYes
TTFB for distant visitorsDepends on distance to your serverUsually lower
Extra costNonePaid add-on on the free plan
ComplexityLowModerate; 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.