Download the PHP package m2-oh/module-cloudflare without Composer
On this page you can find all versions of the php package m2-oh/module-cloudflare. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package module-cloudflare
Magento 2 Cloudflare Integration
A lightweight Magento 2 module that:
- Purges Cloudflare cache automatically whenever Magento's cache is flushed (admin panel or CLI).
- Resolves real visitor IPs by reading the
CF-Connecting-IPheader that Cloudflare injects, so Magento logs, rate-limiters, and geo-IP lookups see the actual client address instead of a Cloudflare proxy IP.
Requirements
| Dependency | Version |
|---|---|
| PHP | ≥ 8.1 |
| Magento | 2.4.x |
| m2-oh/module-core | * |
Installation
Configuration
Navigate to Stores → Configuration → OH Core → Cloudflare.
| Field | Description |
|---|---|
| Enable Cache Purge | Master switch. When disabled, no API calls are made. |
| Account Email | The email address associated with your Cloudflare account. |
| Global API Key | Your Cloudflare Global API Key. Stored encrypted. |
| Zones to Purge | Multi-select of zones fetched live from the Cloudflare API. |
Tip: Save your email and API key first, then reload the page — the Zones field will populate automatically.
How It Works
Cache Purge
The module listens to three Magento cache events:
| Event | Trigger |
|---|---|
adminhtml_cache_flush_system |
Admin → Cache Management → Flush Magento Cache |
adminhtml_cache_flush_all |
Admin → Cache Management → Flush Cache Storage |
clean_media_cache_after |
Admin → Flush Media Storage |
When any of these events fires and the module is fully configured, Client::purgeAll() calls cachePurgeEverything for each configured zone via API. A success or per-zone failure message is displayed in the admin.
Real IP Resolution
A plugin on Magento\Framework\HTTP\PhpEnvironment\RemoteAddress::getRemoteAddress() replaces the result with $_SERVER['HTTP_CF_CONNECTING_IP'] when present. This is a standard Cloudflare header that is always set when traffic passes through their proxy.
All versions of module-cloudflare with dependencies
magento/framework Version *
m2-oh/module-core Version *
cloudflare/sdk Version ^1.3