Cloudflare
Cache your Magento storefront HTML at the Cloudflare edge without breaking cart, checkout, customer accounts, admin, REST or GraphQL. The module applies the rules Magento already ships for Varnish to Cloudflare, purges by cache tag when Magento cleans its full page cache, writes the recommended cache rules for you, runs 25 health checks and shows Cloudflare traffic in the admin. Free and open source under OSL-3.0, for Luma and Hyva on every Cloudflare plan.
✦HTML at the edge, safely
Only pages Magento's own full page cache calls public are cached. Cart, checkout, accounts, admin, REST and GraphQL always carry private, no-store.
✦Purges that follow Magento
When Magento invalidates a product, category, CMS page or block, the same cache tags are purged at Cloudflare through a queue that collapses an import into a few calls.
✦25 health checks
Token, zone settings, cache rules, Magento config and live storefront probes, run hourly and on demand, each with what to fix. Rocket Loader and Auto Minify included.
✦Free and open source
OSL-3.0. No licence key, no paid tier, no kill switch. One package for Magento Open Source and Adobe Commerce, Luma and Hyva, on every Cloudflare plan.
Cloudflare edge caching for Magento, done the way Magento does it
Most Magento stores on Cloudflare run it as a pass-through: static files are cached, HTML is not, so the speed gain is small. The usual fix is a "Cache Everything" rule, which caches checkout, account pages and logged-in prices for the next visitor. OCM Labs Cloudflare applies the rules Magento already ships for Varnish to Cloudflare, so the edge caches exactly what Magento's own full page cache would and nothing else.
Storefront HTML at the edge, safely
Every page Magento's full page cache considers public is sent with Cache-Control: public, s-maxage and a Cache-Tag header built from Magento's cache tags. Everything else, meaning bypass paths, POSTs, responses that set a store, currency or login context, and every page while edge caching is off, is sent with private, no-store. Session cookies are stripped from cacheable responses the same way Magento's Kernel and VCL do. Browsers always get max-age=0 on HTML, so a purge reaches returning visitors too.
Edge caching is off by default. Nothing changes on the storefront until you turn it on, and while it is off a zone with a "Cache Everything" rule cannot cache HTML by accident.
Purges that follow Magento's own invalidation
When Magento invalidates a product, category, CMS page or block, the module purges the same cache tags at Cloudflare. Purges go through a queue, so a catalog import collapses into a few API calls, and a rate limiter follows Cloudflare's per-plan limits and honours Retry-After. A full page cache flush in admin purges the zone. Every purge is recorded in System > Cloudflare > Purge Log with a Retry action for anything that failed.
Recommended cache rules, written for you
The module writes the Cloudflare cache rules a Magento store needs: cache HTML with the right edge TTL, bypass the paths that must never be cached, and handle vary contexts. Rules are previewed as a diff and applied next to any rules you wrote yourself, never over them. On Enterprise zones it can use custom cache keys; on other plans it uses a bypass rule. If your API token cannot edit rules, the docs give you the six expressions to paste by hand.
25 health checks
The Health tab checks the API token, the zone settings that break Magento (SSL mode, Rocket Loader, Auto Minify, Email Obfuscation, Always Online, Browser Cache TTL), the cache rules, the Magento configuration (edge cache on, cache type enabled, consumer running, real IP working, theme detected) and then probes the live storefront: a cacheable page, a bypass page, a vary page and the origin's own headers. Checks run hourly from cron and on demand, and each one says what to fix.
See what Cloudflare is doing from inside Magento
The dashboard under System > Cloudflare shows the zone, its plan and development mode with a quick purge, plus requests, cache hit ratio and bandwidth over 24 hours, 7 days or 30 days depending on the plan.
Real visitor IPs
The real visitor IP is restored from CF-Connecting-IP, but only for requests that really came from a Cloudflare IP. Cloudflare's IP ranges are refreshed daily with a bundled fallback, so rate limiting, fraud checks and logs see the shopper, not the proxy.
Varnish behind Cloudflare
Already on Varnish? In Varnish mode the module leaves Magento's headers and cookies to Varnish and keeps the edge marker and Cache-Tag for the VCL. A Cloudflare-aware VCL is exported from the CLI or the Health tab.
Multi-website
Each website can map to its own zone and its own API token. Websites that share a zone each own their own set of cache rules.
Technical details
- Magento Open Source / Adobe Commerce 2.4.4 - 2.4.9, PHP 8.1 / 8.2 / 8.3 / 8.4
- Install:
composer require ocmlabs/module-cloudflare - One package for Luma and Hyva, Open Source and Commerce
- CLI:
ocmlabs:cloudflare:purge,status,dev-mode,health,rules:apply,vcl:export - Queue consumer
ocmlabsCloudflarePurge, run by cron or supervisor - ACL permissions for the dashboard, purging, the purge log and configuration
- Configuration under Stores > Configuration > OCMLabs > Cloudflare;
general/enabledis a kill switch - Free and open source, OSL-3.0
✦ IN THE STORE & IN THE ADMIN
See it working.
✦ INSTALLATION
Two commands. Like it should be.
# keys provisioned to your dashboard at purchase $ composer require ocmlabs/module-cloudflare $ bin/magento setup:upgrade
✦ RELEASE LOG
Maintained like production code - because it is.
v1.0.0 · 2026-10-22
- Initial release: edge caching of storefront HTML with Cache-Control, CDN-Cache-Control and Cache-Tag headers built from Magento's own full page cache rules, off by default.
- Purging by cache tag, URL, prefix or everything, triggered by Magento's cache invalidation, queued through the ocmlabsCloudflarePurge consumer with a per-plan rate limiter and a purge log.
- Recommended cache rules previewed as a diff and applied without touching rules the merchant wrote; custom cache keys on Enterprise zones.
- Admin dashboard with Overview, Analytics and Health tabs; 25 health checks run hourly and on demand.
- Real visitor IP from CF-Connecting-IP for requests from Cloudflare IPs, Cloudflare-aware Varnish VCL export, multi-website zones and tokens, and six CLI commands.
✦ THE OCM LABS LICENSE
Your code. Your keys.
✦ MODULE QUESTIONS
Before you buy.
✦ SUPPORT
Support & Documentation
Need more help?
Our support team typically responds within 1 business day.