Search code examples
phpcomposer-phpartifactoryjfrog-cli

302 redirect while downloading Jfrog PHP private artifact


Downloading (connecting...)
Downloading (connecting...)
Update failed (The \
"https://abc.jfrog.io/artifactory/api/composer/php-local/direct-dists/@abc/framework/abc_code.zip" \
file could not be downloaded, got redirect without Location (HTTP/1.1 302 Found))
Would you like to try reinstalling the package instead [yes]? 

This was working earlier suddenly stopped.

In browser also working fine. Only while doing composer update or composer install

  • Composer version: 1.5.6
  • VagrantBox: 7.0
  • PHP: 5.5
  • Host OS: MacOS
  • Vagrant : 2.3
  • VirtualBox : 7.2
  • Scientific Linux release 6.5 ( CentOS )

Solution

  • This got solved by upgrading Composer version to 2.

    Jfrog throwing error when there is composer version 1.x while pulling Artifact.

    Sometime an OS doesn't easily upgrade to Composer 2 due to missing CA certificates.

    Can follow below steps:

    1. cd /etc/pki/tls/certs
    2. check ca-bundle.crt file is there or not: file /etc/pki/tls/certs/ca-bundle.crt
    3. sudo curl https://curl.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt -k run this command to download the CA certificates extracted from Mozilla.
    4. upgrade composer using following this page https://getcomposer.org/download/ :
      php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
      php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
      php composer-setup.php
      php -r "unlink('composer-setup.php');"
      
      (always take the latest version from the download page as it changes from time to time)