Showing incorrect client IP in stats



I have installed a self-hosted copy of Piwik, and use the proxy script as described here:

To hide the domain name of where the Piwik script is installed.

Everything was working fine when I used the default geo tracking.

But my problem is now that I have set Piwik to use the GeoIP (Php) tracking (I’m using a shared host) all of the IPs being reported are the IP of my server, and no longer the true client IP.

I followed the recommend changes listed in the FAQ here:

My config.ini.php now includes:

assume_secure_protocol = "1"
proxy_client_headers[] = "HTTP_X_FORWARDED_FOR"
proxy_host_headers[] = "HTTP_X_FORWARDED_HOST"
salt = "c0c87632260cf1d18493d6a03a85XXXX"
trusted_hosts[] = ""
trusted_hosts[] = “

But it has made no difference.

Can anyone help me with this at all?

The correct browser, OS and pages viewed are all showing correct, just not the IP/Country (Im in the UK, hosting in the US).

Many thanks!

(Kuba Bomba) #2

Tracker proxy script uses cip parameter to forward the IP address. The value is extracted here. IMO you don’t need these settings:

proxy_client_headers[] = "HTTP_X_FORWARDED_FOR"
proxy_host_headers[] = "HTTP_X_FORWARDED_HOST"

It’s possible that forcing the IP address via cip parameter doesn’t work because of a wrong token_auth. Could you confirm that this token is a valid superuser token? Depending on your configuration, it should be set either in the config file or in the script directly.


Actually this is for a webserver that is behind a proxy not for the tracking proxy!