Piwik and Load Balancers

Ran into an issue with Piwik not seeming to deal with load balancers and the X-Forwarded-For header. The documentation for setting up this relativly common thing is a little lacking in the official documentation, and I found it’s a bit prickly. I finally found the instructions here but it neglects to mention that it needs to be exactly this way. To summarize though, the steps are as follows;
1. add the line proxy_client_headers[] = "HTTP_X_FORWARDED_FOR" (note the HTTP, all caps, and underscores
2. On your LB (or proxy) make sure that the ip header is X-Forwarded-For. (note the proper caps, and the dashes)

Leave a comment

Your email address will not be published. Required fields are marked *