WordPress.org

Plugin Directory

Opened 7 months ago

Closed 6 months ago

#2631 closed enhancement (fixed)

geoplugin improvements

Reported by: paulotaylor Owned by: polimorfico
Priority: high Severity: major
Plugin: not-listed Keywords: quaderno, cache, curl, timeout
Cc:

Description

New Relic seems to be reporting slow performance on my website and seems to be due to the geoplugin.net calls that can really slow down the whole website.

Would be really nice if the geoplugin.net queries would be cached and/or set the CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT curl options to limit the damage

Change History (6)

comment:1 @polimorfico7 months ago

Hey Paul! Thanks for warning. Just fixed this issue by adding a timeout option to limit the damage. Please check it out in version 1.12.13.
Let me know if you have any questions. Happy to help :-)

comment:2 @paulotaylor7 months ago

  • Resolution set to fixed
  • Status changed from new to closed

OK, thanks! I'll let you know if I have any more issues.

Cheers

comment:3 @paulotaylor6 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:4 @paulotaylor6 months ago

$_SERVER [ 'HTTP_X_FORWARDED_FOR' ] can return multiple IPs (comma-separated list of IP addresses) and that breaks the geo plugin API call

Something like this might work better (so says stackoverflow.com)

function get_ip_address(){
    foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key){
        if (array_key_exists($key, $_SERVER) === true){
            foreach (explode(',', $_SERVER[$key]) as $ip){
                $ip = trim($ip); // just to be safe
                if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false){
                    return $ip;
                }
            }
        }
    }
}

comment:5 @polimorfico6 months ago

Just launched a new version (1.9.0) that uses the WooCommerce Geolocation function. Please check it out.

comment:6 @paulotaylor6 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.