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

        Issue Links

          Activity

          Hide
          jtom Joe Tom added a comment -

          Verified slashes are no longer encoded in log. Also verified successful migration and that the components migrated can be accessed. Thanks!

          Show
          jtom Joe Tom added a comment - Verified slashes are no longer encoded in log. Also verified successful migration and that the components migrated can be accessed. Thanks!
          Hide
          plynch Peter Lynch added a comment -

          Here is an example of the effect of this change:

          Before - Nexus 2 request.log
          127.0.0.1 - - [09/Jan/2017:15:38:57 -0500] "GET /nexus/service/siesta/migrationagent/repository-content/central/xpp3%2Fxpp3_min%2F1.1.4c%2Fxpp3_min-1.1.4c.pom HTTP/1.1" 200 1610 1
          
          After - Nexus 2 request.log
          127.0.0.1 - - [09/Jan/2017:16:34:37 -0500] "GET /nexus/service/siesta/migrationagent/repository-content/central/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.pom HTTP/1.1" 200 1610 1
          
          Show
          plynch Peter Lynch added a comment - Here is an example of the effect of this change: Before - Nexus 2 request.log 127.0.0.1 - - [09/Jan/2017:15:38:57 -0500] "GET /nexus/service/siesta/migrationagent/repository-content/central/xpp3%2Fxpp3_min%2F1.1.4c%2Fxpp3_min-1.1.4c.pom HTTP/1.1" 200 1610 1 After - Nexus 2 request.log 127.0.0.1 - - [09/Jan/2017:16:34:37 -0500] "GET /nexus/service/siesta/migrationagent/repository-content/central/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.pom HTTP/1.1" 200 1610 1

            People

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

              Dates

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

                Agile