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

Last-modified HTTP header for npm package metadata does not update after adding new package version

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Automatically Closed
    • Affects Version/s: 3.21.1, 3.22.1, 3.25.1, 3.29.0
    • Fix Version/s: None
    • Component/s: NPM
    • Notability:
      3

      Description

      Problem:

      We have on our site a Nexus (OSS 3.22.1-02) npm proxy repo for a hosted Nexus (OSS 3.21.1-01) npm repo on customer site. The repository isn't updating the metadata (also after invalidating Cache and rebuild index).

      After enabling debug log level I saw that our Nexus receives HTTP-statuscode "304 Not modified".

      In my opinion the http-header "Last-modified" for the metadata on the hosted repo should be updated after an npm package is added.

      The hotfix for me was to delete the metadata for this package manually in the proxy repo.

      Log (our local Nexus npm proxy repo):

      2020-04-21 15:42:52,481+0200 DEBUG [qtp1262325706-19562]  admin org.sonatype.nexus.repository.npm.internal.NpmProxyFacetImpl - Fetching: GET https://remotenexus.example.com/repository/npm-releases/test-package HTTP/1.1
      2020-04-21 15:42:52,489+0200 DEBUG [qtp1262325706-19562]  admin org.sonatype.nexus.httpclient.outbound - https://remotenexus.example.com/repository/npm-releases/test-package > GET /repository/npm-releases/test-package
       HTTP/1.1
      2020-04-21 15:42:52,492+0200 DEBUG [qtp1262325706-19562]  admin org.sonatype.nexus.internal.httpclient.SharedHttpClientConnectionManager - Connection request: [route: {s}->https://remotenexus.example.com:443][total kept alive: 0; route all
      ocated: 0 of 20; total allocated: 0 of 200]
      2020-04-21 15:42:52,493+0200 DEBUG [qtp1262325706-19562]  admin org.sonatype.nexus.internal.httpclient.SharedHttpClientConnectionManager - Connection leased: [id: 5067][route: {s}->https://remotenexus.example.com:443][total kept alive: 0;
      route allocated: 1 of 20; total allocated: 1 of 200]
      2020-04-21 15:42:52,569+0200 DEBUG [qtp1262325706-19562]  admin org.sonatype.nexus.internal.httpclient.SharedHttpClientConnectionManager - Connection [id: 5067][route: {s}->https://remotenexus.example.com:443] can be kept alive for 30.0 se
      conds
      2020-04-21 15:42:52,571+0200 DEBUG [qtp1262325706-19562]  admin org.sonatype.nexus.internal.httpclient.SharedHttpClientConnectionManager - Connection released: [id: 5067][route: {s}->https://remotenexus.example.com:443][total kept alive: 1
      ; route allocated: 1 of 20; total allocated: 1 of 200]
      2020-04-21 15:42:52,572+0200 DEBUG [qtp1262325706-19562]  admin org.sonatype.nexus.httpclient.outbound - https://remotenexus.example.com/repository/npm-releases/test-package < HTTP/1.1 304 Not Modified @ 89.30 ms
      2020-04-21 15:42:52,573+0200 DEBUG [qtp1262325706-19562]  admin org.sonatype.nexus.repository.npm.internal.NpmProxyFacetImpl - Response: HttpResponseProxy{HTTP/1.1 304 Not Modified [Date: Tue, 21 Apr 2020 13:42:52 GMT, Server: Nexus/3.21.1-01
      (OSS), X-Content-Type-Options: nosniff, Content-Security-Policy: sandbox allow-forms allow-modals allow-popups allow-presentation allow-scripts allow-top-navigation, X-XSS-Protection: 1; mode=block]}
      2020-04-21 15:42:52,574+0200 DEBUG [qtp1262325706-19562]  admin org.sonatype.nexus.repository.npm.internal.NpmProxyFacetImpl - Status: HTTP/1.1 304 Not Modified
      2020-04-21 15:42:52,575+0200 DEBUG [qtp1262325706-19562]  admin org.sonatype.nexus.repository.storage.StorageTxImpl - Transitioning: OPEN -> ACTIVE
      

       

      Request (remote repo - hosted customer repo):

       

      $ curl -v "http://nexus.example.com/repository/npm-releases/example-package"
      

      Response (remote repo - hosted customer repo):

       

      * TCP_NODELAY set
      * Connected to nexus.example.com (192.168.1.125) port 80 (#0)
      > GET /repository/npm-releases/example-package HTTP/1.1
      > Host: nexus.example.com
      > User-Agent: curl/7.58.0
      > Accept: */*
      >
      { [5 bytes data]
      < HTTP/1.1 200 OK
      < Date: Wed, 22 Apr 2020 07:26:04 GMT
      < Server: Nexus/3.21.1-01 (OSS)
      < X-Content-Type-Options: nosniff
      < Content-Security-Policy: sandbox allow-forms allow-modals allow-popups allow-presentation allow-scripts allow-top-navigation
      < X-XSS-Protection: 1; mode=block
      < Last-Modified: Wed, 15 Jan 2020 21:56:09 GMT
      < Content-Type: application/json
      < Transfer-Encoding: chunked
      < Vary: Accept-Encoding
      <
      { [3995 bytes data]
      100  424k    0  424k    0     0   596k      0 --:--:-- --:--:-- --:--:--  597k
      * Connection #0 to host nexus.example.com left intact
      

       

      Screenshot from remote site (hosted repo on customer site):

      NPM last_modified is 2020-04-21 and the http/content last-modified is 2020-01-15.

        Attachments

          Activity

            People

            Assignee:
            mchernikov Maksym Chernikov
            Reporter:
            florian.probst Florian Probst
            Last Updated By:
            Joe Tom Joe Tom
            Team:
            NXRM - Rocket Raccoon
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response:

                tigCommentSecurity.panel-title