PHPackages                             m2-oh/module-cloudflare - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. m2-oh/module-cloudflare

ActiveMagento2-module[Caching](/categories/caching)

m2-oh/module-cloudflare
=======================

Magento 2 module that integrates Cloudflare cache purging and real-IP resolution.

v1.0.3(3y ago)02981OSL-3.0PHPPHP &gt;=7.4

Since Feb 14Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/oh-ecommerce-agency/m2-oh-cloudflare)[ Packagist](https://packagist.org/packages/m2-oh/module-cloudflare)[ RSS](/packages/m2-oh-module-cloudflare/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (5)Used By (0)

Magento 2 Cloudflare Integration
================================

[](#magento-2-cloudflare-integration)

A lightweight Magento 2 module that:

1. **Purges Cloudflare cache** automatically whenever Magento's cache is flushed (admin panel or CLI).
2. **Resolves real visitor IPs** by reading the `CF-Connecting-IP` header that Cloudflare injects, so Magento logs, rate-limiters, and geo-IP lookups see the actual client address instead of a Cloudflare proxy IP.

---

Requirements
------------

[](#requirements)

DependencyVersionPHP≥ 8.1Magento2.4.x[m2-oh/module-core](https://github.com/orignalhabit/m2-oh-core)\*---

Installation
------------

[](#installation)

```
composer require m2-oh/module-cloudflare
bin/magento module:enable OH_Cloudflare
bin/magento setup:upgrade
bin/magento cache:flush
```

---

Configuration
-------------

[](#configuration)

Navigate to **Stores → Configuration → OH Core → Cloudflare**.

FieldDescription**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
------------

[](#how-it-works)

### Cache Purge

[](#cache-purge)

The module listens to three Magento cache events:

EventTrigger`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 StorageWhen 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

[](#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.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance58

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~28 days

Total

4

Last Release

1101d ago

PHP version history (2 changes)v1.0.0PHP ~7.3.0||~7.4.0

v1.0.1PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/6ef0946d1134231071ab2222cebbd6c036717b7311291a4fa37b2b90ee7e278c?d=identicon)[ohecommerce](/maintainers/ohecommerce)

---

Top Contributors

[![0franco](https://avatars.githubusercontent.com/u/10506275?v=4)](https://github.com/0franco "0franco (6 commits)")[![oh-ecommerce-agency](https://avatars.githubusercontent.com/u/83262167?v=4)](https://github.com/oh-ecommerce-agency "oh-ecommerce-agency (2 commits)")

---

Tags

cachecloudflaremagentomagento2magento2-extensionmagento2-extension-freemagento2-modulemagento2-module-freemagento2-pluginphp

### Embed Badge

![Health badge](/badges/m2-oh-module-cloudflare/health.svg)

```
[![Health](https://phpackages.com/badges/m2-oh-module-cloudflare/health.svg)](https://phpackages.com/packages/m2-oh-module-cloudflare)
```

###  Alternatives

[lizardmedia/module-varnish-warmer

Varnish Cache Warmer Magento2 module by Lizard Media

6276.8k](/packages/lizardmedia-module-varnish-warmer)[vendic/module-optimize-cache-size

Magento 2 extension that reduces the number of cache keys by removing catalog\_product\_view\_id\_, catalog\_product\_view\_sku\_, catalog\_product\_view\_attribute\_set\_, catalog\_category\_view\_id\_ layout handles by default

3453.6k](/packages/vendic-module-optimize-cache-size)[litespeed/module-litemage

LiteMage Full Page Cache for LiteSpeed Web Server

3254.8k](/packages/litespeed-module-litemage)[redchamps/module-easy-cache-clean

Clean invalidated cache(s) easily in a Magento 2 store

2838.0k](/packages/redchamps-module-easy-cache-clean)[yireo/magento2-autoflushcache

2813.5k](/packages/yireo-magento2-autoflushcache)[graycore/magento2-graph-ql-cache

A Magento 2 module that modifies the built-in GraphQlCache FPC.

121.5k](/packages/graycore-magento2-graph-ql-cache)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
