#3463 closed Bug (fixed)

GeoIP ServerBased not working when ip masquerading is enabled

Reported by: ts77 Owned by: capedfuzz
Priority: major Milestone: 1.9.1 - Piwik 1.9.1
Component: Core Keywords:
Cc: Sensitive: no

Description

I found that I still had to have the GeoIP databases in the misc folder even though the server based geoip processing is enabled which means that the server based info is not used.

The issue is, in my opinion, in ServerBased.php in the beginning of the getLocation function:

	public function getLocation( $info )
	{
		// geoip modules that are built into servers can't use a forced IP. in this case we try
		// to fallback to another version.
		$myIP = Piwik_IP::getIpFromHeader();
		if ($info['ip'] != $myIP
			&& (!isset($info['disable_fallbacks'])
				|| !$info['disable_fallbacks']))
		{

If you are anonymizing the IP address it will never match the one from the header or the one returned from the ServerBased localization.
The header contains the full ip address and the server based localization also returns the full ip address but piwik - internally - has the anoymized ip address which is just rarely the same.

I'd suggest to either leave out that check or apply the same anonymization to the $myIP as to the one send into this function.

Change History (3)

comment:2 Changed 18 months ago by matt (mattab)

  • Owner set to capedfuzz

Thanks for the report!

We'll check that it works OK with IP anonymization on.

comment:3 Changed 18 months ago by capedfuzz (diosmosis)

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

(In [7285]) Fixes #3463, allow serverbased geoip provider to work w/ anonymized IPs & add description about this issue in provider description.

Note: See TracTickets for help on using tickets.