A simple, drop in plugin to get the correct client IP behind CloudFlare.
Just download drop this folder in your /plugins/
directory and activate it.
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.
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.
This is 98% CloudFlare's IP Rewrite Package, just wrapped into a WP Plugin that we can later extend.