@Fensterbank opened this Issue on June 30th 2015 Contributor

I have a piwik installation in a corporate intranet behind a proxy.
We could not get the internet connection (e.g. version check) for Piwik work.

curl_exec: Received HTTP code 405 from proxy after CONNECT.

I want to trigger the auto archiving via scheduled task, because scheduled reports are not sent automatically, but unfortunately the Piwik console needs to have a internet connection.

INFO Piwik\Access[2015-06-30 07:29:33] [46f82] ---------------------------
INFO Piwik\Access[2015-06-30 07:29:33] [46f82] INIT
INFO Piwik\Access[2015-06-30 07:29:33] [46f82] Piwik is installed at: https://piwik.abcdefghi.com/index.php
INFO Piwik\Access[2015-06-30 07:29:33] [46f82] Running Piwik 2.13.0 as Super User
ERROR Piwik\Access[2015-06-30 07:29:33] [46f82] The Piwik URL https://piwik.abcdefghi.com/index.php does not seem to be pointing to a Piwik server. Response was 'Got invalid response from API request: https://piwik.abcdefghi.com/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp. Response was 'curl_exec: Received HTTP code 405 from proxy after CONNECT. Hostname requested was: piwik.abcdefghi.com''.

a test script with following content does work without problems from the servers command line, so normally Piwik shoud reach itself over https...

$homepage = file_get_contents('https://piwik.abcdefghi.com');
echo $homepage;

I do not understand why it is necessary for the auto archive script to open an internet connection via curl_exec.
Wouldn't it be better to handle server side scripts on the server without HTTP API calls?

@gaumondp commented on June 30th 2015

Did you tried settings mentioned here #6324 ?

enable_marketplace = 0
enable_auto_update = 0
enable_update_communication = 0

@diosmosis commented on June 30th 2015 Member

If the command is using HTTP requests to archive, it means the system you're using doesn't support archiving through new PHP processes. This can be because you're using windows, because the shell_exec function is disabled, the ps or awk programs do not exist or for several other reasons. In any case, the core:archive command needs to send HTTP requests for your setup.

If you are running the command on Piwik server itself, you could try supplying --url=http://localhost to the core:archive command. Let me know if this works for you, as this may not be possible in 2.14. In this case, I'll make sure it's possible in 2.14.1.

@Fensterbank commented on July 1st 2015 Contributor

Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404

localhost
Wed Jul 1 09:02:15 2015
Apache/2.2.22 (Linux/SUSE)
@diosmosis commented on July 1st 2015 Member

Perhaps the user that runs the web server or runs PHP is not allowed to connect to the internet? Did you run your test scripts in the same way IIS does or did you run them directly through php.exe? Can you connect to localhost or 127.0.0.1 through something hosted on IIS? I'm not familiar w/ IIS, but it sounds like a system configuration issue to me.

@Fensterbank commented on July 3rd 2015 Contributor

Hello again,

changing the running user did not help.
But I solved the issue, and yes, it was a crazy configuration problem!
A few months ago I followed the advice on http://piwik.org/faq/troubleshooting/#faq_121 because the update check didn't worked and added the following lines to my config.ini.php:

[proxy]
host = "proxy.abcdefghi.com"
port = 8000

But like you see in this issue, it never helped, Piwik could never connect somewhere.
Now I removed this proxy setting and the console archive script works! :+1:
The update check and auto update does still not work, but I don't care, I will update manually.

Maybe it has something to do that Piwik used the configured proxy to connect to its hostname while the hostname is not available from outside the intranet. Using a proxy to connect to an intranet site would be wrong. Maybe half a bug here?

While using force_ssl = 1, I had to add --accept-invalid-ssl-certificate to get the script working (the ssl certificate is valid in our corporation, but I think piwik is using another cert store), but finally it works for me good enough.

You can close the issue.

@diosmosis commented on July 3rd 2015 Member

Maybe it has something to do that Piwik used the configured proxy to connect to its hostname while the hostname is not available from outside the intranet. Using a proxy to connect to an intranet site would be wrong. Maybe half a bug here?

I don't think the proxy settings should be used when connecting to localhost/127.0.0.1. I created an issue here: https://github.com/piwik/piwik/issues/8272

@tassoman commented on November 24th 2015 Contributor

I wonder this modification slows my development on local machine while I'm behind company's proxy because of my http://piwik.local installation runs on localhost apache also if I connect to it from another LAN machine. Piwik is prevented to download remote content.

Can we add a force_use=1 inside [Proxy] INI config?

Temporarily, I've disabled outer http fetching as explained in #6324

This Issue was closed on July 3rd 2015
Powered by GitHub Issue Mirror