iThemes blocking Cloudflare IPs | WordPress.org

[ad_1]

We use CloudFlare and it’s proxying the user IP addresses and passes their edge IP address instead.

To bypass this issue we’ve added the following code in a mu-pluging

<?php
if ( isset($_SERVER['HTTP_CF_CONNECTING_IP']) && !empty($_SERVER['HTTP_CF_CONNECTING_IP']) ) {
    $cloudflare_connecting_ip = explode(',', $_SERVER['HTTP_CF_CONNECTING_IP'] );
    if ( is_array($cloudflare_connecting_ip) && !empty($cloudflare_connecting_ip) ) {
        $_SERVER['REMOTE_ADDR'] = $cloudflare_connecting_ip[0];
    }
}

This has resolved the issue for the rest of our code, but for some reason iThemes is still blocking the CloudFlare IPs instead of the actual user IPs.

I understand it’s unlikely to add support for CloudFlare, but can you confirm what variable you use to block IPs, because $_SERVER['REMOTE_ADD'] is probably not the one.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer