Visual studio nuget 没有使用 HTTPS 配置的提要,而是使用 HTTP
Visual studio nuget is not using the HTTPS configured feed and use HTTP instead
我在 https url 上创建了一个 nuget teamcity 提要:
https://teamcity:xyz/httpAuth/app/nuget/v1/FeedService.svc/
当我推送到 url 或在 visual studio 中列出包时,它可以工作,但是当我从包管理控制台或 visual studio 中的可视化 nuget 包管理工具安装包时我看到它尝试从 http 提要下载,但这不起作用并超时,因为 teamcity 仅打开并允许 https 端口。
Retrieving package 'Test 1.0.0' from 'SAI'.
GET http://teamcity:xyz/httpAuth/app/nuget/v1/FeedService.svc/download/Package/4646:i d/Test.1.0.0.0.nupkg
I receive a timeout :
Retrieving package 'Test 1.0.0' from 'TEST'.
GET http://teamcity:xyz/httpAuth/app/nuget/v1/FeedService.svc/download/Test/4646:id/T est.1.0.0.0.nupkg
....
...
has timed out after 100000ms.
那么,为什么 Visual studio 使用 http?当我查看 nuget 配置文件时,我可以看到提要 url 配置了 HTTPS?
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="TEST" value="https://teamcity:xyz/httpAuth/app/nuget/v1/FeedService.svc/" />
</packageSources>
why Visual studio is using http? When i look in the nuget config file I can see that the feed url is configured with HTTPS?
那是因为 TeamCity 服务器 return 一个用于下载的 http url,而 nuget.exe/visual studio 扩展紧跟在 link 之后。在这种情况下,Visual studio/nuget 没有使用 HTTPS 配置的提要,而是使用 HTTP。
此外,NuGet 服务器 (nuget.org) 和 teamcity 仅允许在 https 端口上使用,因此所有提要 links 和 auth 都会被弄乱,因为 http:// 不正确并且会被重定向到 https://。这也意味着 auth header 不是 re-sent,因此它会导致重定向循环。然后我们会得到超时问题。
要解决此问题,您可以尝试修改 //conf/server.xml 部分以包含最后 3 个属性,使其在 SSL-terminating 代理后正常运行:
<Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="60000"
redirectPort="8543"
useBodyEncodingForURI="true"
socket.txBufSize="64000"
socket.rxBufSize="64000"
tcpNoDelay="1"
secure="true"
scheme="https"
proxyPort="443"
/>
更多详细信息,您可以参考the issue GitHub
我在 https url 上创建了一个 nuget teamcity 提要:
https://teamcity:xyz/httpAuth/app/nuget/v1/FeedService.svc/
当我推送到 url 或在 visual studio 中列出包时,它可以工作,但是当我从包管理控制台或 visual studio 中的可视化 nuget 包管理工具安装包时我看到它尝试从 http 提要下载,但这不起作用并超时,因为 teamcity 仅打开并允许 https 端口。
Retrieving package 'Test 1.0.0' from 'SAI'.
GET http://teamcity:xyz/httpAuth/app/nuget/v1/FeedService.svc/download/Package/4646:i d/Test.1.0.0.0.nupkg
I receive a timeout :
Retrieving package 'Test 1.0.0' from 'TEST'.
GET http://teamcity:xyz/httpAuth/app/nuget/v1/FeedService.svc/download/Test/4646:id/T est.1.0.0.0.nupkg
....
...
has timed out after 100000ms.
那么,为什么 Visual studio 使用 http?当我查看 nuget 配置文件时,我可以看到提要 url 配置了 HTTPS?
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="TEST" value="https://teamcity:xyz/httpAuth/app/nuget/v1/FeedService.svc/" />
</packageSources>
why Visual studio is using http? When i look in the nuget config file I can see that the feed url is configured with HTTPS?
那是因为 TeamCity 服务器 return 一个用于下载的 http url,而 nuget.exe/visual studio 扩展紧跟在 link 之后。在这种情况下,Visual studio/nuget 没有使用 HTTPS 配置的提要,而是使用 HTTP。
此外,NuGet 服务器 (nuget.org) 和 teamcity 仅允许在 https 端口上使用,因此所有提要 links 和 auth 都会被弄乱,因为 http:// 不正确并且会被重定向到 https://。这也意味着 auth header 不是 re-sent,因此它会导致重定向循环。然后我们会得到超时问题。
要解决此问题,您可以尝试修改 //conf/server.xml 部分以包含最后 3 个属性,使其在 SSL-terminating 代理后正常运行:
<Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="60000"
redirectPort="8543"
useBodyEncodingForURI="true"
socket.txBufSize="64000"
socket.rxBufSize="64000"
tcpNoDelay="1"
secure="true"
scheme="https"
proxyPort="443"
/>
更多详细信息,您可以参考the issue GitHub