WP Rocket and Cloudflare are not competitors, but left unconfigured they behave like two cooks who each think they own the kitchen. The clean division of labour: WP Rocket owns the origin — HTML page cache, file optimization, lazy loading — while Cloudflare owns the network — static assets, TLS, security, and only owns HTML if you deliberately give it HTML (APO or a bypass-cookie Cache Rule). Every “site shows old content” ticket on this stack traces to a violation of that division: two layers caching HTML with nobody coordinating the purges.
What’s happening
Out of the box the stack is safe. Cloudflare does not cache HTML by default — it caches static files (CSS, JS, images) and passes page requests through. WP Rocket caches rendered HTML on disk at the origin and serves it fast. One HTML cache, one asset cache, no conflict.
Trouble starts when HTML gets cached at the edge too. Add a Cache Everything rule or enable APO, and a page now exists in three places: WP Rocket’s cache folder, Cloudflare’s edge, and the visitor’s browser. Update a product, and WP Rocket dutifully purges its own copy — but the edge copy lives on until its TTL dies or something purges it. The site looks fixed from wp-admin (logged-in users bypass edge cache) and stale from everywhere else. That asymmetry — “it’s fine for me, old for customers” — is the classic signature of an unowned second HTML cache.
The WP Rocket Cloudflare add-on exists to coordinate, not to cache. With API credentials and the zone ID configured, it does four things: purges Cloudflare when WP Rocket clears its own cache (the critical one), toggles Cloudflare’s Development Mode from wp-admin, syncs browser-cache TTL, and offers an “Optimal settings” switch that adjusts the zone — including turning Rocket Loader off, because WP Rocket’s own Delay JavaScript and Rocket Loader deferring the same scripts twice is a reliable way to break a site. The add-on does not enable edge HTML caching, and it is not APO — those remain your explicit decisions.
What to check first
- Is HTML currently cached at the edge? A
cf-cache-status: HITon a page URL answers it — ifDYNAMIC, Cloudflare is not your staleness problem. - Is the Cloudflare add-on enabled in WP Rocket, with a valid token, account email, and zone ID? An expired token fails silently on some setups.
- Are both Rocket Loader and WP Rocket’s Delay JavaScript active? Pick one; the add-on’s optimal settings pick WP Rocket’s.
- Any legacy Page Rules with Cache Everything that predate the current person responsible? Inventory before designing.
How to verify
# Is the edge serving HTML from cache? DYNAMIC = no, HIT + age = yes
curl -sI https://www.example.com/sample-page/ \
| grep -iE 'cf-cache-status|age|cache-control'
# Does WP Rocket serve its origin cache? Look for its signature comment:
curl -s https://www.example.com/sample-page/ | grep -o 'Performance optimized by WP Rocket'
# Purge-chain test: update a page, then immediately re-check both layers
curl -sI https://www.example.com/sample-page/ | grep -iE 'cf-cache-status|age'
The purge-chain test is the one that matters: edit a page, save, and fetch it as an anonymous visitor within a few seconds. If the content is fresh and cf-cache-status shows MISS or EXPIRED right after the save, the add-on’s purge hook fired. Stale content plus a large age value means WP Rocket purged the origin and nobody told the edge.
The fix
- Decide who owns HTML, in writing. Option A (default, simplest): WP Rocket owns HTML, Cloudflare owns assets — remove any Cache Everything rules and skip APO. Option B (global audience, spiky traffic): the edge owns HTML via APO or a cookie-bypass Cache Rule, and WP Rocket stays for origin cache and optimizations. Both are sound; ambiguity is not.
- Connect the add-on properly. WP Rocket > Add-ons > Cloudflare: account email, API token (scoped to the zone with cache-purge and settings permissions — not your Global API Key), zone ID. Save, then run the purge-chain test above.
- Apply the add-on’s optimal settings and let it disable Rocket Loader. If you keep Rocket Loader on purpose, disable WP Rocket’s Delay JavaScript — never both.
- If you chose Option B with a Cache Rule, build the bypass conditions for logged-in and WooCommerce cookies exactly as in the WooCommerce bypass-cookie recipe, and confirm WP Rocket’s “Never cache cookies” list mirrors the same cookies so both layers agree on who gets personalized pages.
- If you chose APO (US$5/month on Free, included on Pro and up), keep the official Cloudflare plugin active for its purge integration, keep WP Rocket’s page cache on as the origin layer behind edge misses, and read the coexistence details in Cloudflare APO deep configuration.
- Verify the whole chain once per quarter: save a post, watch it propagate — origin fresh, edge purged, browser revalidating.
When this fix is wrong
- Staleness only for logged-in users is not a cache-layer fight — edge and WP Rocket both bypass them. Look at object caching or a misbehaving plugin.
- Slow TTFB with
cf-cache-status: DYNAMICand no WP Rocket signature means neither cache is working; fix WP Rocket’s basic operation before designing coordination. - Browser-level staleness (fixed by a hard reload) is a
Cache-Control/versioning question, not a purge question.
Common mistakes
- Running Cache Everything “because more caching is more speed” without bypass cookies, and serving one shopper’s pages to another.
- Using the Global API Key in the add-on instead of a scoped token — a compromise of wp-admin then hands over the entire Cloudflare account.
- Enabling every WP Rocket optimization and every Cloudflare optimization, then bisecting a broken site across two dashboards. Change one layer at a time.
- Assuming the add-on enables edge HTML caching — it only coordinates purges.
- Leaving Development Mode on after debugging — it auto-expires after 3 hours, but the toggle-and-forget habit is real.
Prevention
- Document the ownership decision (A or B) in the site runbook, with the purge chain drawn out: save → WP Rocket purge → Cloudflare purge.
- Alert on the symptom, not the mechanism: a synthetic check comparing a just-edited sentinel page against its expected content catches every purge failure regardless of layer.
- Re-run the purge-chain test after WP Rocket major updates and Cloudflare token rotations — both have silently broken the hook in the wild.
- When adding any third cache (LiteSpeed, Redis page cache, a host’s built-in layer), redo the ownership map first — the decision framework is in the WordPress cache stack compared, and edge cache mechanics are in the Cloudflare cache docs.
Two caches with one owner each is fast; two caches with no owner is a staleness generator. Need Cloudflare stabilized in front of a WordPress or WooCommerce site that earns money? Stack Harbor runs that exact stack under Enterprise WordPress — book an infrastructure consult.