Cannot push nuget packages to BaGet behind an IIS Reverse Proxy
See original GitHub issueDescribe the bug
I’m using BaGet inside a windows docker image. IIS 10 is used as a reverse proxy. This is the web.config file used to proxy queries with the pattern domain.de/nuget/ to the BaGet server which is running in a Windows Docher container on another machine with the IP 192.168.178.2.
<rule name="nuget" stopProcessing="true">
<match url="nuget/(.*)" />
<action type="Rewrite" url="http://192.168.178.2:5555/{R:1}" />
<serverVariables>
<set name="HTTP_FORWARDED" value="for={REMOTE_ADDR};by={LOCAL_ADDR};host="{HTTP_HOST}";proto="https"" />
<set name="HTTP_X_FORWARDED_HOST" value="{HTTP_HOST}" />
<set name="HTTP_X_FORWARDED_SCHEMA" value="https" />
<set name="HTTP_X_FORWARDED_PROTO" value="https" />
</serverVariables>
</rule>
This is my baget.env :
ApiKey=NUGET-SERVER-API-KEY
PathBase=/nuget
Storage__Type=FileSystem
Storage__Path=c:\packages
Database__Type=Sqlite
Database__ConnectionString=Data Source=C:\packages\baget.db
Search__Type=Database
When Im running however the nuget push command it uses the internal IP address (the url of docker container) and not the one of the proxy.
$ dotnet nuget push -s https://proxydomain.de/nuget/v3/index.json -k NUGET-SERVER-API-KEY package.nupkg
info : Pushing package.nupkg to 'https://192.168.178.2:5555/api/v2/package'...
info : PUT https://192.168.178.2:5555/api/v2/package/
info : An error was encountered when fetching 'PUT https://192.168.178.2:5555/api/v2/package/'. The request will now be retried.
info : A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
info : PUT https://192.168.178.2:5555/api/v2/package/
info : An error was encountered when fetching 'PUT https://192.168.178.2:5555/api/v2/package/'. The request will now be retried.
info : A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
info : PUT https://192.168.178.2:5555/api/v2/package/
error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
The angular UI isnt running at all. Thats seems to be however the typical problem with the base element not set correctly.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:32 (2 by maintainers)
Top Results From Across the Web
Cannot push nuget packages to BaGet behind an IIS Reverse ...
I'm using BaGet inside a windows docker image. IIS 10 is used as a reverse proxy. This is the web.config file used to...
Read more >Nuget feed behind IIS reverse proxy not working
Hi, I am using IIS as a reverse proxy. It is working as expected except for the Nuget feed. The <Content> element for...
Read more >c# - NuGet behind a proxy
I'm trying to run some build and NuGet can't connect. How do I configure the proxy settings on the command line? c# ·...
Read more >How to Set Up All the NuGet Package Managers [In Depth]
The first step is creating a new Windows service. Since this NuGet.Server wrapper doesn't use IIS, you can't piggyback onto IIS. With the ......
Read more >Automatically publish packages to a BaGet/Nuget running ...
I've picket BaGet (https://loic-sharma.github.io/BaGet/) and set up a dockerfile, called from Docker-Compose. This all works. However, I want to ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@loic-sharma Yes you’re right, these are two separate issues. The
ForwardedHeaders.XForwardedHost
should fix the first issue. The second is (in my opinion) not only just a nice to have. Usually when using a reverse proxy, you want to redirect multiple applications to different servers. For example:Without the possibility to host an application under a subpath, it is (as far as I know) not possible to use it in a normal reverse proxy scenario.
This is the BaGet issue. When you run a push command from CLI,
nuget.exe
will request for a config json file that contains all necessaries urls. It then cache that config file at\AppData\Local\NuGet\v3-cache\<some random string>$_nuget.devmoba.com_v3_index.json
and use the settings in that file to continue the process (of pushing packages). Changing some IIS config will definitely not help you to change this file 's content.So, my work around is manually change all the URLs in that file to
http://my.company.name
instead ofhttp://locahost:xxxx
Hopefully the next release will let us change this by a setting line.