So I’m using the matomo-php-tracker on my website with a Self-Hosted Matomo instance on a different server and everything works, except for the Visitor IP inside Matomo always displays my Websites Server IP for every Visitor, instead of the Visitors IP.
I thought this could maybe be a proxy issue. But I am using the Matomo Tracking API, shouldn’t the API be reading the JSON data passed to it, instead of the headers sent from the server? It reads all other data passed correctly, such as the user agent, browser, operating system, etc.
I checked the JSON data being sent from my Websites Server to the Matomo Server’s API and the IP’s being sent to Matomo are the correct visitor IP addresses. But Matomo seems to be ignoring them.
Just for testing sake, I did try all the proxy header options I could find online:
proxy_client_headers = HTTP_X_FORWARDED_FOR
proxy_client_headers = HTTP_CF_CONNECTING_IP
proxy_client_headers = HTTP_CLIENT_IP
proxy_ip_read_last_in_list = “0”
No luck with any of them.
I also noticed in the guides the Auth Token needs to be generated by a Super User. But my account only has a super user. Similarly I noticed some mention to use $this->setIp, instead of just $this->ip, so I tried using that/both.
Matomo still ignored both and only displaying the Websites Server IP for all visitors.
I know that Matomo is getting the data from the POST headers sent to the API, because none of the JSON data being sent to the Matomo API contains the Server IP at all.
Is there a specific setting I need to put into the config when using the API?
Or does anybody have any ideas? I’ve been racking my head over this for days.
Thanks