If you're using Piwik behind a reverse proxy with a different path like "rewrite ^/piwik/(.*)$ /$1 break;" (nginx.conf), you can provide a header "proxy_set_header X-Forwarded-Uri /piwik;". If you're enabling the config "proxy_uri_header = 1", the header will be considered to the current script name.
It's necessary, because the redirect after login and links e.g. the logo are not working correctly without.
See question at https://stackoverflow.com/q/46080031/5453237
Thanks for the PR @user121216 :+1: This issue is likely experienced by many users and would be a welcome solution!
If you're using Piwik behind a reverse proxy with a different path such as
rewrite ^/piwik/(.*)$ /$1 break;(in
nginx.conf), you would need to:
- configure the web server to provide a header:
proxy_set_header X-Forwarded-Uri /piwik;.
- in Piwik config/config.ini.php, add
proxy_uri_header = 1below the
[General]section, so that Piwik will use the
I wonder if using an HTTP header is a better choice than allowing for a
uri_prefix variable directly in the
global.php.ini. If there is no case where we want to dynamically change the URI prefix, then we do not need to send it with every request to Piwik. I don't know all of the ways in which Piwik is used though, so maybe that's a feature?
@user121216 what influenced your decision to use an HTTP header?
@ToBeReplaced My decision was inspired by the proxy_host_headers variable and the docker environment. I have 2 docker containers (Nginx proxy and Apache with Piwik). The Piwik container is a standalone solution and the rewrite rule is from the Nginx proxy, so I wanted to keep the reason and the config together in one file (nginx.conf). Another solution could be also to run the Piwik instance under the right directory on the Apache container (/piwik), but this is not a smart way for me.
@mattab You're right. These issues are similar. Next time I have to search better :)