• We’re using LogicHop and geolocation on WPEngine. Recently we noticed that the geolocation functionality was broken. On investigating, we tracked the issue down to the get_client_ip() method in LogicHop’s core.php file.

    Specifically, this block of code:

    if (array_key_exists('HTTP_CF_CONNECTING_IP', $_SERVER) && !empty($_SERVER['HTTP_CF_CONNECTING_IP'])) {
    	$client_ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
    }

    In our WPEngine environment, HTTP_CF_CONNECTING_IP does not contain a single IP address, but sometimes two or three, separated by commas,. e.g.. (this is just an example):

    $_SERVER['HTTP_CF_CONNECTING_IP'] => '10.199.1.1,10.199.1.2'

    When this happens, geolocation functionality breaks completely. The only way we’ve been able to restore it is by editing core.php and removing the block of code above, allowing LogicHop to fall back to another server variable that has the correct (single) IP address.

    This is probably more of a Cloudflare issue than a LogicHop issue, but wanted to make you aware that it might be possible for the server variable value to contain multiple IP addresses so you could check for and parse out the first address, if this is the case.

    • This topic was modified 1 year, 9 months ago by hansoninc.
Viewing 1 replies (of 1 total)
  • Plugin Author Logic Hop

    (@logichop)

    Thank you for taking the time to bring this issue to our attention. Your detailed information regarding the get_client_ip() method and the HTTP_CF_CONNECTING_IP server variable.
    Please expect the correction to be made in the next few hours. Once completed, we will inform you immediately so that you can confirm the resolution on your end. We appreciate your patience and understanding while we work on this issue.

    Warm regards,

Viewing 1 replies (of 1 total)
  • The topic ‘Cloudflare can break geolocation’ is closed to new replies.