WP Manifestindependent plugin directory
manifest / utilities / wp-cloudflare-ip-rewrite

Sole Cloudflare IP

WordPress plugin to get the correct client IP behind cloudflare.

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/solegraphics/wp-cloudflare-ip-rewrite/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

A simple, drop in plugin to get the correct client IP behind CloudFlare.

Installation

Just download drop this folder in your /plugins/ directory and activate it.

How it works

It checks if the REMOTE_ADDR is from CloudFlare (for security) and then sets REMOTE_ADDR to HTTP_CF_CONNECTING_IP to ensure we get the real client IP.

Todos

It would be nice if the plugin was self-maintaining for getting authorized CloudFlare IP's. We should update the $cf_ipv4 and $cf_ipv6 arrays to fetch them on a nightly cron and store as a transient.

Credits

This is 98% CloudFlare's IP Rewrite Package, just wrapped into a WP Plugin that we can later extend.