Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to profile URL behind CDN/Load Balancer (e.g. Cloudflare) #100

Open
tperalta82 opened this issue Oct 11, 2016 · 1 comment
Open
Labels

Comments

@tperalta82
Copy link

On header.php:
if ($controlIPs === false || in_array($_SERVER['REMOTE_ADDR'], $controlIPs) || PHP_SAPI == 'cli')

This will not be vaild if behind reverse proxy e.g: cloudflare / varnish / others

Should be something like this:
function getUserIP()
{
$client = @$_SERVER['HTTP_CLIENT_IP'];
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
$remote = $_SERVER['REMOTE_ADDR'];

if(filter_var($client, FILTER_VALIDATE_IP))
{
    $ip = $client;
}
elseif(filter_var($forward, FILTER_VALIDATE_IP))
{
    $ip = $forward;
}
else
{
    $ip = $remote;
}

return $ip;

}

@aik099 aik099 changed the title In case a request is made on a URL that is behind Cloudflare, no profiling will be made by request Unable to profile URL behind CDN/Load Balancer (e.g. Cloudflare) Oct 11, 2016
@aik099 aik099 added the bug label Oct 11, 2016
@aik099
Copy link
Collaborator

aik099 commented Oct 11, 2016

Agreed. Please send a PR, where IP address detection will be made using new function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants