为什么我可以看到文件列表,但不能通过Artifactory远程存储库下载文件?
如果您可以看到文件列表,但是不能通过Artifactory远程存储库下载文件,那么问题的根源可能是Artifactory正在使用的代理。
因为您可以看到文件列表,所以您可能能够看到可用版本的列表。但是,当尝试下载文件时,服务器会重定向到文件实际存储的另一个目的地。如果远程存储库配置为使用代理:
例如,当试图下载这个文件时:'https://updates.jenkins-ci.org/download/plugins/ant/1.2/ant.hpi, Jenkins CI服务器返回重定向到另一个URL(例如:“http://mirror.xmission.com/jenkins/plugins/ant/1.2/ant.hpi”)
为了检查这是否是问题的根源,您可以运行一个简单的curl命令,通过与Artifactory使用的完全相同的代理配置(“webproxylisted”)。重要的是在Artifactory机器上运行它,而不是通过Artifactory。
命令格式如下:
curl -fv -x http://
通常,当目标URL未被批准或代理中不允许重定向时,该命令的响应中会有详细的消息,因此如果最终结果与200不同,您将能够看到代理阻止它的原因,并与您的it部门协商解决方案。
例如,正确的回答应该是这样的:
curl -fv -x http://localhost:8888 https://updates.jenkins-ci.org/download/plugins/ant/1.2/ant.hpi -L > result.hpi
*即将连接()到代理localhost端口8888 (#0)
...
...
< HTTP/1.1 302找到
...
*向这个URL发送另一个请求:'http://mirrors.jenkins-ci.org/plugins/ant/1.2/ant.hpi'
*即将连接()到代理localhost端口8888 (#1)
*尝试127.0.0.1…
*连接到本地主机(127.0.0.1)端口8888 (#1)
> GET http://mirrors.jenkins-ci.org/plugins/ant/1.2/ant.hpi HTTP/1.1
> User-Agent: curl/7.29.0 . txt
>主持人:mirrors.jenkins-ci.org
>接受:*/*
>代理连接:Keep-Alive
>
< HTTP/1.1 302找到
...
<位置:http://mirror.xmission.com/jenkins/plugins/ant/1.2/ant.hpi
...
*向这个URL发送另一个请求:'http://mirror.xmission.com/jenkins/plugins/ant/1.2/ant.hpi'
...