Composer\Downloader\TransportException - Failed to open stream: HTTP request failed

Today I had struggle with using composer in a new docker-environment. For example while trying to install symfony, i received this error:

[Composer\Downloader\TransportException]
The "http://repo.packagist.org/p/provider-2019-07%2464c3c0374a0541958602c66c4b7654eafc0a265b180945a3fef255312d1890f8.json" file could not be downloaded: failed to open stream: HTTP request failed

A little confused I started the diagnose:

composer diag

An key-error showed up:

Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up
Checking composer version: OK
Composer version: 1.9.3
PHP version: 7.3.14
PHP binary path: /usr/bin/php7.3

After adding the keys with composer self-update --update-keys the command failed again. Next step was to use the -vvv flag in the command to change the verbose output (to get more details). Still same unexpected result and the only helpful information was the error like above (http failed). Next I checked the url with wget and had to recognise, that the http-request failed, but a https-request succeed. So I performed the following command:

composer config --global repos.packagist composer https://packagist.org

I don't have a clue where the change came from. But right now, I'm happy because it cost a few hours.

Es wurden noch keine Kommentare verfasst, sei der erste!