Need to Capture Public IP

I want to capture public ip in Matomo dashboard.
But when any visitor hit the site Matomo capturing only private ip.
I have already tried the solution that was posted in forum

I have set Matomo through IIS (IIS version is 6) and there is no load balencer.
Matomo version is 4.5.
Can anyone please help me to fix the issue?

Do you mean you’re capturing CDN IP at the moment, and not the actual visitor’s IP?

Not the CDN IP, we are getting actual private IP, Need public IP of the user

Hi @tanaykundu
You’ll be able to find some hints at:

We tried the configuration as per the link shared
proxy_client_headers[] = HTTP_X_FORWARDED_FOR
proxy_host_headers[] = HTTP_X_FORWARDED_HOST
proxy_client_headers[] = HTTP_CF_CONNECTING_IP
proxy_client_headers[] = HTTP_CLIENT_IP

As we are using standard proxy configuration through IIS.
Post these updates we restarted IIS and cleaned up the app pool but it did not helped and it’s still capturing private IP.

Any other configuration changes to try?

Hi @tanaykundu
I think you have to check the full HTTP request that Matomo receives (with all headers) in order to see which one is to be used. Also, in HTTP requests, is there any cip query param in use (in addition with token_auth)?

Hi, thank you for all the suggestions. The issue has been resolved. I added the ‘X-Forwarded-For’ header from the server end.

1 Like