Results tagged “reverse proxy”

Piwik generates its URLs used in links and forms based on data in $_SERVER[]. If you are using a reverse proxy in front of your web server, the incoming request URLS are for the internal server. This results in the people from the outside getting 404 errors after the getting the initial landing page.

To work around this, I was able to use Piwik's boostrap.php file. This is loaded first for any Piwik page. I added some code in there to rewrite PHP's $_SERVER[] parameters to match the original request to the proxy. The variables I had to set were


  • $_SERVER['HTTP_HOST']

  • $_SERVER['PHP_SELF']

  • $_SERVER['SCRIPT_NAME']

  • $_SERVER['REQUEST_URI']

1
Close