Tag Archives: Nuget Visual Studio

Nuget package listing fails on the machine behind corporate firewall

I was unable to browse packages from visual studio, Package Manager Console or GUI. The message would be no packages found in the current source. Using Fiddler, I am opted to watch the traffic being sent, and all HTTP requests are successfully made and completed. When searching for “Log” I get a single request for the count of items (45), and then the follow up filter request with all 45 package items in detail. To verify if something within our corporate network was blocking the request, I also made each of the requests from Internet Explorer, and both were successful.

I realised that the response type is different and seems our corporate firewall policy is blocking them. I browsed for the solution and I found the it in Nuget Issue tracker which is helpful:
You can get around it with Fiddler2 and FiddlerScript. Edit the FiddlerScript, find the method “OnPeekAtResponseHeaders” and add the following code fragment before the method closing brace.

  if (oSession.HostnameIs("packages.nuget.org") && oSession.oResponse["Content-type"].Contains("text/xml")) {
        oSession.oResponse["Content-type"] = oSession.oResponse["Content-type"].Replace("text/xml", "application/atom+xml");

This will modify the response type. Thank you Nuget guys…