Nexus NuGet v3 repo behind reverse proxy

Hey there. I have Nexus OSS 3.25-1.04 behind Nginx reverse proxy. I’ve created NuGet repository. It’s OK by using external and internal URL. But when I try to use it as NuGet v3 repo I see only internal URLs inside index.json file. I open it via https://external_url/repository/nuget_repo/index.json. BTW whatever URL is used in the very first request to a repo after Nexus service startup is embedded into index.json .
Is it a normal behavior or is there any additional settings for this case?

@slaffka.vlasov If I understand your question correctly then this sounds like normal behaviour. If NXRM return external URLs then your Nuget client would circumvent the repository manager and go direct to the remote. NXRM replaces the URLs so that all requests go through it and packages get cached correctly.

so does it mean that the very first request to the repo after service restart “fulfills” index.json with URLs depends on the request? I mean that if you enter internal URL you will see only internal URLs inside index.json

Correct. It should be possible to fix that URL to a specific value using the Base URL capability if you need: Base URL Capability

aah I saw these KB thanks. But I’ve thought that it can rewrite URLs only in email notifications.

and I’ve just tried to create a new NuGet repo and access it via IP address. Now I see only IP addresses inside index.json

Let me clarify original request regarding reverse-proxy, expected and actual behavior.

Nexus instance is running behind reverse-proxy. As a result it can be accessed with http://external_url and http://internal_url.
The instance hosts nuget hosted repository, which we want to be available over nuget api version 3.
Version 3 of the protocol assumes that nuget feed shall be added using /repository/nuget-hosted/index.json URL.

Given external and internal URLs, nuget feeds look like:

Expected behavior is that index.json is referencing endpoints using whatever URL was used to access it: when external URL is used, index.json shall reference everything starting from http://external_url and when internal URL is used, index.json shall reference everything starting from http://internal_url

However, on practice we see that the very first request to nuget repository after Nexus service startup seem to make Nexus “remember” URL and embed it into index.json regardless whether it is accesses over internal or external URL. For instance, if first request is made using http://internal_url/repository/nuget-hosted/index.json, then for all subsequent requests Nexus will reference everything in index.json starting from http://internal_url. Even if subsequent requests are made over http://external_url. Even from different browsers. Even from different PC.

Base URL Capability has no effect on this behavior. The only factor we are currently seeing that has effect is which URL was used to make first request to index.json after Nexus service has started.

So, the question is. Should it really behave this way?

@adm.malax That is because the index.json metadata is cached for performance optimization. If you set Max metadata age to 0 does it then get regenerated on each request? If not you will have to file an Improvement request at

@jstephens Your explanation seems very likely.
I can’t find any documentation where Max Metadata age can be set. The only article I found is Understanding Caching Configuration – Sonatype Support, but judging by the text, this is only applicable to proxy repositories. Which is not our case. We are using hosted repository.
Could you please point me towards where Max Metadata age you were talking about can be set? Or where I can read about it?

Ah didn’t realize this was hosted / group. You will need to file an improvement ticket to make the caching of that file configurable.

1 Like

I’ve raised the ticket about these issue. Maybe there is a way to fix it :slight_smile:

1 Like