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

Make sure to return correct IP when all IPs are excluded #9099

Merged
merged 1 commit into from Nov 2, 2015
Merged

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Oct 27, 2015

refs #8721

I tried to reproduce #8721 with the given server data from #8721 (comment)

I did not get 0.0.0.0 but it returned 82.197.211.195, 82.197.211.195 which is wrong as well as it should be 82.197.211.195.

Problem was it called

$excludedIps = array($defaultIp = '82.197.211.195')
Ip::getLastIpFromList($csv = '82.197.211.195, 82.197.211.195', $excludedIps);

In this case it returned 82.197.211.195, 82.197.211.195 as it did detect there were multiple IPs given but then returned the same $csv as non of them were allowed. The $defaultIp was the same as the ones specified in other headers from:

proxy_client_headers[] = "HTTP_X_FORWARDED_FOR"
proxy_client_headers[] = "HTTP_CF_CONNECTING_IP"
proxy_client_headers[] = "HTTP_CLIENT_IP"
proxy_client_headers[] = "REMOTE_ADDR";

$_SERVER['REMOTE_ADDR'] = '82.197.211.195';
$_SERVER['HTTP_X_FORWARDED_FOR'] = '82.197.211.195';
$_SERVER['HTTP_CF_CONNECTING_IP'] = '82.197.211.195';

In the users case it was actually not needed to specify multiple proxy_client_headers. I'm not sure if it will actually fix the issue but it was a bug

@tsteur tsteur added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Oct 27, 2015
@tsteur tsteur added this to the 2.15.1 milestone Oct 27, 2015
@tsteur
Copy link
Member Author

tsteur commented Nov 2, 2015

FYI: User says it looks like it's fixed so we can probably just merge

mattab pushed a commit that referenced this pull request Nov 2, 2015
Make sure to return correct IP when all IPs are excluded
@mattab mattab merged commit 5dd57c8 into master Nov 2, 2015
@mattab mattab deleted the 8721 branch November 2, 2015 03:26
@mattab
Copy link
Member

mattab commented Nov 2, 2015

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants