@astehlik opened this issue on July 9th 2015

I had a really strange issue today and it occured since the update to 2.14.0.

I'm using the command line interface for archiving:

php_cli /html/piwik/console core:archive --url=http://mydomain.tld/piwik/

During that call I got an error, because the script tried to use the IP address to access the Piwik Server which does not work because there is no virtual host entry for the IP.

I finally managed to figure out that there was in invalid URL written to piwikUrl setting which is used for making API calls.

I also managed to figure out where the IP address came from: Piwik was accessible from a host that was not added to the trusted hosts setting. Therefore the hostname is read from the SERVER_ADDR variable which contained the IP address instead of HTTP_HOST which contained the actual hostname.

I see two problems here: ### 1. URL parameter is ignored

The parameter passed to the console command --url is totally ignored when archiving is run. I would expect Piwik to use that parameter instead of the value that is stored in the piwikUrl setting to make API calls. ### 2. Trusted host setting is bypassed

When a HTTP_HOST header is provided and the host is not trusted there should be no fallback to SERVER_ADDR. Only when the HTTP_HOST is empty it should be possible to fallback to SERVER_ADDR.

I hope this makes sense to you :)

@mattab commented on July 10th 2015

Hi @astehlik

can you try --piwik-domain= parameter instead: do you have the same issue?

@mattab commented on July 15th 2015

Fyi: a workaround to this issue is to make sure your system supports managing Processes via CLI, ie. you need to: - use a non-windows server, - use a non-synology server, - have shell_exec enabled, - support ps, awk functions, - have a /proc filesystem.

@mattab commented on July 23rd 2015

This was also (indirectly) reported in the forums: http://forum.piwik.org/read.php?2,128367

@mattab commented on July 23rd 2015

It was also reported in http://forum.piwik.org/read.php?2,128384

@diosmosis since many users report this issue as blocking for them to run the cron, could we restore this feature in 2.14.2 and not have to wait 2.15.0?

This issue was closed on July 24th 2015
Powered by GitHub Issue Mirror