composer: Composer stopped working behind corporate proxy
At my client’s office, all web traffic is funneled through a proxy. This hasn’t been a problem for composer until recently. If I perform a self-update
, any composer operation with outbound traffic will fail afterwards. After a rollback to my previous version (1.0.0-alpha9-18-g3ff8bcf 2014-12-08 22:04:10
), everything’s back to normal.
My development machine is a Ubuntu 14.10 installation with the bundled php 5.5.12 package.
Environment Variable | Value |
---|---|
http_proxy | http://1.2.3.4:8080/ |
https_proxy | http://1.2.3.4:8080/ |
(Read 1.2.3.4
as the IP address of the proxy. I cannot post the real IP addresses here. 😉 )
$ composer --version
Composer version 1.0.0-alpha9-18-g3ff8bcf 2014-12-08 22:04:10
$ composer diag
Checking platform settings: FAIL
The xdebug extension is loaded, this can slow down Composer a little.
Disabling it when using Composer is recommended, but should not cause issues beyond slowness.
Checking git settings: OK
Checking http connectivity: OK
Checking HTTP proxy: OK
Checking HTTP proxy support for request_fulluri: OK
Checking HTTPS proxy support for request_fulluri: OK
Checking disk free space: OK
Checking composer version: FAIL
You are not running the latest version
$ sudo composer self-update
Updating to version e172cd81a146666d844d2b7b37b5feccb89e2b61.
Downloading: 100%
Use composer self-update --rollback to return to version 1.0.0-alpha9-18-g3ff8bcf
$ composer diag
Checking platform settings: FAIL
The xdebug extension is loaded, this can slow down Composer a little.
Disabling it when using Composer is recommended, but should not cause issues beyond slowness.
Checking git settings: OK
Checking http connectivity: FAIL
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
Failed to enable crypto
failed to open stream: operation failed
Checking HTTP proxy: FAIL
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
Failed to enable crypto
failed to open stream: operation failed
Checking HTTP proxy support for request_fulluri: OK
Checking HTTPS proxy support for request_fulluri: FAIL
Unable to assess the situation, maybe github is down (The "https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
Failed to enable crypto
failed to open stream: operation failed)
Checking disk free space: OK
Checking composer version:
[Composer\Downloader\TransportException]
The "https://getcomposer.org/version" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
Failed to enable crypto
failed to open stream: operation failed
diagnose
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 32 (6 by maintainers)
I recently ran into this issue on Ubuntu, so I just wanted to throw it out here. But the trouble I ran into was using the protocol prefix in the proxy setting.
Composer didn’t like
http_proxy=http://myproxy.com:8080
orhttps_proxy=https://myproxy.com:8080
but it works fine when they’re defined as
http_proxy=myproxy.com:8080
andhttps_proxy=myproxy.com:8080
I had the same issue - and I’m still unsure what the cause is, because I have no idea of proxy stuff. But the following configuration works:
export http_proxy=http://1.2.3.4:56
export HTTP_PROXY=http://1.2.3.4:56
export https_proxy=
export HTTPS_PROXY=
while any other combination does NOT work:
export http_proxy=http://1.2.3.4:56
export HTTP_PROXY=http://1.2.3.4:56
export https_proxy=https://1.2.3.4:56
export HTTPS_PROXY=https://1.2.3.4:56
and
export http_proxy=
export HTTP_PROXY=
export https_proxy=
export HTTPS_PROXY=
Seems weird to me. Maybe still a composer issue?
+1 for this
Solution:
I had the same issue - and I’m still unsure what the cause is, because I have no idea of proxy stuff. But the following configuration works:
export http_proxy=http://1.2.3.4:56 export HTTP_PROXY=http://1.2.3.4:56 export https_proxy= export HTTPS_PROXY=
while any other combination does NOT work:
export http_proxy=http://1.2.3.4:56 export HTTP_PROXY=http://1.2.3.4:56 export https_proxy=https://1.2.3.4:56 export HTTPS_PROXY=https://1.2.3.4:56
and
export http_proxy= export HTTP_PROXY= export https_proxy= export HTTPS_PROXY=
Seems weird to me. Maybe still a composer issue?
thaaaaaaaaaaaanks @antiphp just clear https_proxy and it working like a charm (Y)
Were looking for this for an hour. If you don’t want to mess up your current configuration just use before composer command.
@armin-abbasi, composes uses environment variables
http_proxy
andhttps_proxy
for proxy configuration. Sometimes proxy has issues with SSL (using https), so composer will try to clone Git repo instead of direct download (this is much slower and takes more disk space).These commands temporary remove proxy variables from the current bash session, so Composer won’t use proxy settings and download packages directly without a proxy.