Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When installing Piwik, the port is not correctly saved for trusted_hosts #9549

Closed
tsteur opened this issue Jan 18, 2016 · 13 comments · Fixed by #20807
Closed

When installing Piwik, the port is not correctly saved for trusted_hosts #9549

tsteur opened this issue Jan 18, 2016 · 13 comments · Fixed by #20807
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@tsteur
Copy link
Member

tsteur commented Jan 18, 2016

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.

@tsteur tsteur added the Bug For errors / faults / flaws / inconsistencies etc. label Jan 18, 2016
@mattab
Copy link
Member

mattab commented Mar 31, 2016

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?

@mattab mattab modified the milestones: 2.16.x (LTS), Mid term Mar 31, 2016
@larsnystrom
Copy link

I think the description of this ticket is backwards. The problem is that if you install piwik on mydomain:8000 the installation script adds trusted_hosts[]="mydomain" to 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")

@J0WI
Copy link

J0WI commented Jan 21, 2019

This can easily be reproduced using Docker:

  1. setup a database container named some-mysql
  2. docker run --rm -p 127.0.0.1:8080:80 --link some-mysql:mysql matomo
  3. follow the install wizard steps
  4. you can't login on localhost:8080 because Matomo used trusted_hosts[] = "localhost"

@fhaase2
Copy link

fhaase2 commented Feb 28, 2020

Is there any new information here?

@billyjacoby
Copy link

Has anyone found a solution for this with using Docker?

@CanoSarria
Copy link

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.

@epicfaace
Copy link

The fix to this probably has something to do with this line:

$config->General['trusted_hosts'] = [
$host,
'localhost',
'127.0.0.1',
];

@izgzhen
Copy link

izgzhen commented Dec 8, 2020

quick hack: if you mount the volume like matomo:/var/www/html, you can probably modify /var/lib/docker/volumes/matomo/_data/config/config.ini.php directly and restarted the container.

@passioneight
Copy link

passioneight commented May 11, 2022

Almost 2 years have passed (since the last comment), the issue still persists.

@andreasunterhuber
Copy link

And it does still persist ;)

@sneko
Copy link

sneko commented Jul 25, 2023

I'm using Matomo inside a Docker container, indeed inside the container it listens on 80 but it's bound to 8080 on the host. Triggering the error message.

Any way to disable this easily with an environment variable? Without dealing with Docker volumes & co?

Thank you,

@DaWe35
Copy link

DaWe35 commented Jul 26, 2023

Not working for me. I think an env variable would be better to control the trusted domain

@sgiehl
Copy link
Member

sgiehl commented Jul 27, 2023

This will be fixed/improved with Matomo 5, which was not yet published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.