Eg when installing Piwik via
mydomain:8000, Piwik will probably save
trusted_hosts = mydomain:8000. As soon as the installation is finished, Piwik will not allow you to log in as the URL does not match. Piwik recommends to set
trusted_hosts = mydomain in the UI.
I'm not sure what exactly the error is. Either Piwik saves
trusted_hosts = mydomain:8000 and requires
trusted_hosts = mydomain or it is the other way around. Or the check whether a host matches doesn't correctly check for the port.
If you install Piwik via
mydomain:8000 and then try to open Piwik via
mydomain (without port, or with a different port), it is expected that Piwik will ask you to add
mydomain to trusted_host (The trusted host must include the same hostname and port.). Did you think this was a bug, or is there really a bug?
I think the description of this ticket is backwards. The problem is that if you install piwik on
mydomain:8000 the installation script adds
config/config.ini.php. So when you try to visit piwik at
mydomain:8000 piwik will complain loudly, until you manually edit
config/config.ini.php to include
mydomain:8000 as a trusted host.
So from what I can see, the problem is that the installation script only adds the domain, and not the port, to the
trusted_hosts array in the configuration. (Which is also the title of this ticket, i.e "When installing Piwik, the port is not correctly saved for trusted_hosts")
This can easily be reproduced using Docker:
docker run --rm -p 127.0.0.1:8080:80 --link some-mysql:mysql matomo
localhost:8080because Matomo used
trusted_hosts = "localhost"
Is there any new information here?
Has anyone found a solution for this with using Docker?
Same issue here, I have been searching everywhere and no clue. I don't want to manually change the config file and then restart the service. I want to do it from docker-compose.
The fix to this probably has something to do with this line: https://github.com/matomo-org/matomo/blob/57e252ff5a2fcfaf634a6ee2dd1ec7af8d41632d/tests/resources/install-matomo.php#L169-L173