Cache Magento storefront HTML at the Cloudflare edge, purge by cache tag, and see what Cloudflare is doing from the admin
Most Magento stores on Cloudflare run it as a pass-through. Static files are cached at the edge, 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. OCMLabs Cloudflare applies the rules Magento already ships for Varnish to Cloudflare instead, so the edge caches exactly the pages Magento’s own full page cache would cache, and nothing else.
The module is free and open source. There is no paid tier, no licence key and no feature held back.
Edge caching that follows Magento’s rules
Every page Magento’s full page cache considers public leaves the origin with Cache-Control: public, max-age=0, s-maxage=<ttl> and a Cache-Tag header built from Magento’s cache tags. Everything else, including bypass paths, POSTs and any response that sets a store, currency or login context, is sent with private, no-store. Session cookies are stripped from cacheable responses the same way Magento’s Kernel and VCL do. Edge caching is off by default, and until you turn it on every storefront response is marked no-store, so a zone with a “Cache Everything” rule cannot cache HTML by accident. See Edge Caching.
Purges that match Magento’s invalidation
When Magento invalidates a product, category, CMS page or block, the module purges Cloudflare by cache tag. Purges go through a queue, so a catalog import collapses into a handful of API calls instead of thousands, and a local rate limiter keeps a Free zone inside Cloudflare’s five purges a minute. Every purge is recorded in a log you can read from the admin. See Purging.
Rules, health checks and analytics from inside Magento
The module writes a set of recommended cache rules to the zone, next to any rules you wrote yourself, and shows you the diff first. Twenty-five health checks cover the API token, zone settings that break Magento (Rocket Loader, Email Obfuscation, Flexible SSL), the cache rules, the Magento side, and live probes that fetch the storefront through Cloudflare and read cf-cache-status. An Analytics tab shows requests, cache hit ratio, bandwidth saved, status codes, top paths and more, pulled from Cloudflare’s GraphQL API. See Cache Rules, Health Checks and Analytics.
Works with Luma, Hyva, Varnish and every Cloudflare plan
Cached HTML is safe for both themes, because both render the page anonymously and load private content in the browser after the page loads. Purge by tag is available on every Cloudflare plan; only custom cache keys for store views and currencies need Enterprise. Behind Varnish, the module exports a Cloudflare-aware VCL so the edge can cache what Varnish caches. The real visitor IP is restored from CF-Connecting-IP, but only for requests that really came from Cloudflare.
At a glance
- MODULE
- OCMLabs_Cloudflare (Composer: ocmlabs/module-cloudflare)
- MAGENTO
- 2.4.4 and later, Open Source and Adobe Commerce
- PHP
- 8.1 or later
- PRICE
- Free, open source, OSL-3.0
- CACHING
- Edge caching of public HTML, built-in full page cache or Varnish behind Cloudflare
- PURGING
- By tag, URL, prefix or everything; queued, batched, rate-limited per plan, logged
- ADMIN
- Dashboard (Overview, Analytics, Health), purge log, config with Test Connection and Detect Zone
- CLI
- purge, status, dev-mode, health, rules:apply, vcl:export
Links
Cloudflare is free and open source. Browse all OCM Labs Magento extensions. The agency behind the modules offers installation and upgrade help and custom module work.