Proxy repository pointing to a group

We are setting up a series of Nexus servers and our current model is to use one as the primary server and on the other remote servers use proxy repositories pointing back to the primary. This works fine when the proxy repository on the secondary server is pointing to a hosted repository on the primary server. Searches using the service/rest/v1/search/assets endpoint against the secondary server return a list of the items on the primary. However if the proxy repository on the secondary server is pointing to a group on the primary server then the service/rest/v1/search/assets endpoint on the secondary server returns an empty list of items.

Is it possible to use a proxy repository on one server to point to a group on another server? If so what is needed to make this work?

Thanks!

A proxy repository pointing to a group repository should work just fine. Keep in mind that the search APIs on the secondary servers will only know about items that have been requested from that proxy - if nobody asks for a package it doesn’t exist on the secondary server and Repository Manager won’t proxy the search request back to the primary one.

Note that the same thing applies to proxy repositories in general. If you have a maven-central proxy, searching for content in that proxy will only return results from things that have been requested through the proxy. The full list of dependencies on maven central is quite large.

Can any one help me : Is there Any kind of workaround or alternative Solution for “Pro version feature - Smart proxy” for OSS ? As Request for Proxy Group fails due to proxy Repository not cached from hosted until Request to repository been done.

@mmartz thank you for the response. I have a follow up question to make sure I am understanding things correctly.

If I have two servers, one primary and one secondary and they are configured as follows:

  • The primary is configured with a hosted repository.
  • The secondary is configured with a proxy repository that points back to the primary’s hosted repository.

If I use the following search on the primary

curl -X 'GET' \
  'http://PRIMARY:8081/nexus/service/rest/v1/search/assets?q=foo&repository=bar&format=jar&version=3' \
  -H 'accept: application/json'

I get back what I expect because a full search of the repository is done. However the same search against the secondary:

curl -X 'GET' \
  'http://SECONDARY:8081/nexus/service/rest/v1/search/assets?q=foo&repository=bar&format=jar&version=3' \
  -H 'accept: application/json'

Will only return a list of matching items that have already been retrieved from the primary explicitly. Is that correct?

Thanks!

The Search API only works for content that your server has proxied.

If the particular format has a builtin search (i.e. npm search) then using the clients endpoint should query the remote

@mpiggott / @mmartz : Is there Any kind of workaround or alternative Solution for “Pro version feature - Smart proxy" kind for OSS ? As Request for Secondary nexus -Proxy fails due to not being cached from hosted until Request to Primary - repository been done. As Colin said in above , our tests are failing due to same issues, Repo type used is maven2, not npm. Please help

That kind of feature (smart proxy), if we add it, will be a Pro feature and not available for OSS.

I’m still unclear on what problem exactly you are having. You cannot use the search api of a proxy repository to determine what maven content is available in the hosted repository. If you have a proxy repository pointing to a hosted repository and then maven tries to run a build through that proxy it should get anything it needs from the hosted repository with some exceptions related to the proxy’s cache settings.

@mmartz : Proxy Repository (Secondary node) which is pointing to Hosted Repository (primary node)works Perfectly fine…but Issue is on the Repository Group (on Secondary node- which uses proxy repo) does not gives expected results for query or curl wont work for the data that has not been cached on Proxy Repository from Primary or hosted, So we are trying to have same functionality for Group as like repository works upon request.

A proxy repository within a group should behave exactly the same as when it’s not in a group.