Why can I see the file list, but I cannot download a file via an Artifactory remote repository?

If you can see the file list, but you cannot download a file via an Artifactory remote repository, the source of the problem might be with a proxy that Artifactory is going through.


Since you can see the file-list, you can probably able to see the list of versions available. However, when trying to download a file, the server redirects to another destination where the file is actually stored.  If your remote repository is configured to use proxy: <proxyRef>webproxylisted</proxyRef>, this issue can occur if the access from Artifactory to a remote repository goes through a proxy, and the proxy does not allow the redirection or blocks the final destination.


For example, when trying to download this file: ‘https://updates.jenkins-ci.org/download/plugins/ant/1.2/ant.hpi’, the Jenkins CI server returns redirection to another URL (e.g. ‘http://mirror.xmission.com/jenkins/plugins/ant/1.2/ant.hpi‘)

In order to check whether this is the root of the problem, you can run a simple curl command from that goes through the same exact proxy configuration that Artifactory uses (‘‘webproxylisted’). It is important to run it from the Artifactory machine, but not through Artifactory.

The command should be as follows:

curl -fv -x http://<user>:<password>@<proxyhost>:<proxyport> https://updates.jenkins-ci.org/download/plugins/ant/1.2/ant.hpi -L > result.hpi

Usually, when the destination URL Is not approved or redirection is not allowed in the proxy, there will be a detailed message in the response of this command, so if the final result is different than 200, you will be able to see the reason why the proxy blocks it and consult with your IT department regarding a solution.

For example, a correct response should look like this:

curl -fv -x http://localhost:8888 https://updates.jenkins-ci.org/download/plugins/ant/1.2/ant.hpi -L > result.hpi

* About to connect() to proxy localhost port 8888 (#0)

< HTTP/1.1 302 Found

* Issue another request to this URL: http://mirrors.jenkins-ci.org/plugins/ant/1.2/ant.hpi

* About to connect() to proxy localhost port 8888 (#1)

* Trying 127.0.0.1…

* Connected to localhost (127.0.0.1) port 8888 (#1)

> GET http://mirrors.jenkins-ci.org/plugins/ant/1.2/ant.hpi HTTP/1.1

> User-Agent: curl/7.29.0

> Host: mirrors.jenkins-ci.org

> Accept: */*

> Proxy-Connection: Keep-Alive

>

< HTTP/1.1 302 Found

< Location: http://mirror.xmission.com/jenkins/plugins/ant/1.2/ant.hpi

* Issue another request to this URL: ‘http://mirror.xmission.com/jenkins/plugins/ant/1.2/ant.hpi

< HTTP/1.1 200 OK