How to run the 25 Cloudflare health checks for a Magento store
Run the 25 Cloudflare health checks for Magento from the admin or CLI, read the message, fix and evidence, and use the exit code as a deploy gate in CI.

Most Cloudflare-in-front-of-Magento problems are one setting, and none of them show up in a Magento log. OCM Labs Cloudflare, the free and open source module, ships 25 health checks that read the zone, the Magento config and the live storefront and tell you what to change.
Where the checks live
- Open System > Cloudflare > Dashboard, pick the website and click the Health tab. Every check is listed with a status of pass, warn, fail or skip, a one-line fix and the evidence the check used.
- The checks run hourly from cron, at 15 minutes past the hour. Click Run checks now to run them on demand.
- Where a fix is a single zone setting, an Apply this fix button changes it from the admin. The button needs the
OCMLabs_Cloudflare::settings_writeACL resource, so a role without it sees the result but not the button.
The same checks run from the command line:
bin/magento ocmlabs:cloudflare:health
bin/magento ocmlabs:cloudflare:health --website=base --jsonWithout --website the command runs for every website that has a zone configured. The plain form prints a table of status, check and message; --json prints the full results with status, message, fix and evidence per check. It exits 1 when any check fails, 2 on bad input, 0 otherwise. The full list is on the health checks docs page.
Connection (2 checks)
| API TOKEN | The token is valid and carries the permissions the module needs. Fix: create a new token with the permissions listed on the Installation page. |
|---|---|
| ZONE MATCHES STOREFRONT | The configured zone's name matches the website's storefront hosts. Catches a Zone ID pasted from the wrong zone. |
If either fails, fix it first; everything below depends on it.
Zone settings (7 checks)
These are Cloudflare settings that break Magento or make caching pointless. Each one shows the current value and offers an Apply this fix button.
| SSL MODE | Full or Full (strict). Flexible makes Cloudflare talk HTTP to the origin, which loops with Magento's secure base URL. |
|---|---|
| ROCKET LOADER | Off. It rewrites script loading and breaks RequireJS on Luma and Alpine.js on Hyva. |
| AUTO MINIFY | Off on zones that still have it. Magento minifies its own assets, and Cloudflare's minifier can break RequireJS modules and Alpine expressions. |
| EMAIL OBFUSCATION | Off. It rewrites addresses inside rendered HTML and injects a script into cached pages. |
| ALWAYS ONLINE | Off. It serves stale prices and stock from the Internet Archive when the origin is down. |
| BROTLI, HTTP/2, HTTP/3 AND EARLY HINTS | On. Warns about each one that is off; none of them breaks Magento, they just make it faster. |
| BROWSER CACHE TTL | Respect Existing Headers. Any override replaces the module's max-age=0 and keeps purged pages alive in visitors' browsers. |
Cache rules (5 checks)
| STOREFRONT CACHE RULE | A [OCMLabs] Cache storefront HTML rule exists for the website's hosts. |
|---|---|
| BYPASS RULES | The bypass rules exist and sit below the cache rule, so they override it. |
| X-MAGENTO-VARY HANDLING | The vary cookie is handled, either by the bypass rule or by a custom cache key on an Enterprise zone. Fix: apply the recommended cache rules. |
| NO POST CACHING | A rule bypasses non-GET requests. |
| EDGE TTL | The TTL the cache rule applies matches the module's edge TTL. Warns when a rule overrides the origin TTL. |
The fix for most of this group is the same: apply the recommended rules, from the Health tab or with bin/magento ocmlabs:cloudflare:rules:apply. Post 4 covers the six rules, the diff and writing them by hand.
Magento (6 checks)
| CLOUDFLARE CACHE TYPE | The ocmlabs_cloudflare cache type is enabled under System > Cache Management. The module stores zone details, analytics and health results in it. |
|---|---|
| EDGE CACHE ENABLED | Enable Edge Caching of HTML is on for the website. Warns, rather than fails, because leaving it off is a valid choice. |
| PURGE QUEUE CONSUMER | Compares the last cache clean event with the last completed purge. Warns when tags are queued but nothing has gone out, which usually means the consumer is not running. |
| STOREFRONT THEME | Detects Luma or Hyva for the website's stores and notes which Cloudflare features would break it. |
| MULTI-STORE EDGE CACHING | Lists the website's store views and currencies and explains that visitors outside the default context bypass the edge unless Vary Handling is Cache key on an Enterprise zone. |
| REAL VISITOR IP | Whether the current admin request's REMOTE_ADDR was a Cloudflare address and CF-Connecting-IP was honored. Only meaningful from an admin request that came through Cloudflare; skipped from the CLI. |
Real visitor IP inspects the admin request you just made. From bin/magento there is no Cloudflare request to inspect, so it reports skip. Click Run checks now from an admin session that came through Cloudflare to get an answer.
Live probes (5 checks)
The probes fetch real storefront pages through Cloudflare and read cf-cache-status. They request a category page twice and expect the second to be a HIT, request a customer page and expect BYPASS or DYNAMIC, and send the vary cookie and expect the edge to step aside. Probe URLs come from the website's own catalog, and a probe refuses to fetch anything that does not resolve to the configured storefront hosts.
| EDGE CACHES A STOREFRONT PAGE | A category page served through Cloudflare reports cf-cache-status: HIT on the second request. |
|---|---|
| EDGE BYPASSES CUSTOMER AND CHECKOUT PAGES | The login page reports BYPASS or DYNAMIC, never HIT. |
| EDGE HANDLES THE VARY COOKIE | A request carrying X-Magento-Vary is not served from the edge cache. |
| ORIGIN SENDS EDGE CACHE HEADERS | Fetches the page directly from Storefront Origin, skipping Cloudflare, and checks that Cache-Control and Cache-Tag arrive intact. Fails when a proxy or Varnish between Magento and Cloudflare strips them. Skipped when Storefront Origin is blank. |
| CACHE-TAG HEADER SIZE | Samples storefront responses and reports pages whose tag list had to be truncated to fit Cloudflare's header limits, with the paths involved. Those pages still purge on a full purge but may miss a tag purge. |
The origin probe only runs when Storefront Origin is set, so a skip on that row means the field is blank. TLS certificate verification is skipped for that fetch, because origin certificates are rarely valid for the public host. Each probe needs the page to answer with HTTP 200; a redirect or error is reported as a failed probe with the status it got.
Reading a result
Every result carries three things:
- Message: what was found.
- Fix: what to change, and where in the Cloudflare dashboard.
- Evidence: the raw values the check looked at, such as the setting value or the response headers.
When you open a support issue, attach bin/magento ocmlabs:cloudflare:health --json, which includes all three for every check. To see by hand what the origin probe sees:
curl -sI -H "Host: www.example.com" https://<origin ip>/some-category.html -k | grep -iE "cache-control|cache-tag"You should get Cache-Control: public, max-age=0, s-maxage=... and a Cache-Tag line.
Using the command as a deploy gate
Because the command exits 1 on any failed check, it slots in as the last step of a deploy, after the rules are applied and the cache is purged:
#!/usr/bin/env bash
set -euo pipefail
bin/magento ocmlabs:cloudflare:rules:apply
bin/magento ocmlabs:cloudflare:purge --all
if ! bin/magento ocmlabs:cloudflare:health --website=base --json > var/log/cloudflare-health.json; then
echo "Cloudflare health checks failed:" >&2
cat var/log/cloudflare-health.json >&2
exit 1
fiTwo limits. Warns do not fail the command, so a stopped purge consumer will not block a deploy; only fails do. And Real visitor IP is always skip from the CLI, so the gate cannot catch a wrong CF-Connecting-IP setup. The same JSON feeds a monitor: run it on a schedule and alert on any fail.
Which checks to look at first
| CF-CACHE-STATUS: DYNAMIC ON EVERY PAGE | Edge cache enabled, Storefront cache rule, then Origin sends edge cache headers if Varnish or a proxy sits in between. |
|---|---|
| PAGES ARE STALE AFTER A PRODUCT SAVE | Purge queue consumer, then Browser Cache TTL. If curl is fresh and the browser is stale, the TTL override is the cause. |
| CHECKOUT, CART OR ACCOUNT PAGES WERE CACHED | Edge bypasses customer and checkout pages. A Cache Everything rule, a page rule or an edge TTL override overrode Magento's headers. Remove it and purge everything. |
| REDIRECT LOOP ON THE STOREFRONT | SSL mode. Flexible is the cause; the check offers to set Full or Full (strict). |
| JAVASCRIPT IS BROKEN ON THE STOREFRONT | Rocket Loader and Auto Minify. Both rewrite the page. |
For the DYNAMIC case, the settings that make a page cacheable are in post 2. One cause no check finds: a block with cacheable="false" in the layout makes the whole page uncacheable. Search the theme and extensions for it.
If you want someone to run the checks against your stack and fix what fails, our performance and infrastructure team does this for Magento stores behind Cloudflare.
✦ FAQ
How often do the Cloudflare health checks run in Magento?+–
What does the health command exit code mean?+–
Why is the Real visitor IP check skipped from the CLI?+–
Why is the Origin sends edge cache headers probe skipped?+–
Can the live probes fetch pages from another site?+–
What should I attach to a support issue?+–

Shane Blandford
Founder of Orange Collar Media, a Denver ecommerce agency behind 800+ Magento and Shopify builds. In Magento since version 1.x - building, rescuing, and supporting revenue-critical stores since 2008.
✦ KEEP READING
Related from the Journal.
Why put Cloudflare in front of Magento: what a CDN does for a store, what it does not, and what breaks
What Cloudflare does for a Magento store: a CDN for static files, edge-cached HTML, DDoS and bot protection, a WAF, and the five settings that break checkout.

OCM Labs Cloudflare: free edge caching for Magento, on Magento's own terms
A free, open-source Magento module that caches storefront HTML at the Cloudflare edge using Magento's own full page cache rules, and purges by cache tag.

How to use Cloudflare development mode and analytics from the Magento admin
Turn Cloudflare development mode on before a theme deploy, run a quick purge and read Cloudflare analytics from the Magento admin with a free module.
