Uploaded image for project: 'Dev - Nexus'
  1. Dev - Nexus
  2. NEXUS-11909

content requests to Nexus 2 by migration agent should avoid HTTP 404 Not Found caused by URL encoding

    Details

    • Type: Story
    • Status: Done
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.14.1, 3.1.0
    • Fix Version/s: 3.2.1, 2.14.3
    • Component/s: Upgrade
    • Labels:
      None

      Description

      Background
      A number of customer bug reports have been traced to the fact that the NX2->NX3 migration REST API is using encoded slashes in requests. This causes problems with reverse proxies, and so far our recommendation is to fine tune the reverse proxy settings. This will continue to be problematic in the future, so let's adjust to eliminate the encoding.

      The problem manifests itself when the HTTP download option is used during upgrade to Nexus 3, and Nexus 3 is sending requests for artifacts to Nexus 2. Nexus 3 sends requests to Nexus 2 with encoded slashes like
      <base url>/service/siesta/migrationagent/repository-content/npmproxy/which%2F-%2Fwhich-1.0.9.tgz, those decoded slashes need to arrive at the Nexus 2 instance unaltered/undecoded in order for migration to work.

      Symptoms

      Requests by the Nexus migration agent to Nexus 2 will fail with 404 not found. Example stack trace from your nexus.log:

      2016-11-08 08:39:26,510+0100 ERROR [plan-executor-5-thread-6] admin com.sonatype.nexus.migration.repository.ProcessChangesStep - Failed processing of CREATE /package/-/package-2.0.1.tgz, will ignore and move on. HTTP 404 Not Found
      javax.ws.rs.NotFoundException: HTTP 404 Not Found
              at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.handleErrorStatus(ClientInvocation.java:201) [na:na]
              at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.extractResult(ClientInvocation.java:174) [na:na]
              at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.BodyEntityExtractor.extractEntity(BodyEntityExtractor.java:59) [na:na]
              at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:104) [na:na]
              at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:64) [na:na]
              at com.sonatype.nexus.migration.client.$Proxy193.get(Unknown Source) [na:na]
      

      This can happen with any repository type.

      Acceptance

      Workaround

      • configure Nexus 3 to send requests to Nexus 2 directly instead of going through an intermediary reverse proxy
      • configure the httpd in front of Nexus 2 with the directive AllowEncodedSlashes NoDecode and the option nocanon for your ProxyPass directive - do a similar change for nginx if using that server
      • upgrade to 2.14.3/3.2.1 once released

        Attachments

          Activity

            People

            • Assignee:
              jtom Joe Tom
              Reporter:
              mprescott Michael Prescott
              Last Updated By:
              Peter Lynch
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Date of First Response: