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

NFC Cache does not work for HEAD requests

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.13.0
    • 3.12.1, 3.13.0
    • Transport

    Description

      Some clients such as Apache Ivy send HEAD requests to determine if artifacts are available, only following up with a GET request if needed.

      When these are sent to Nexus it will not populate the "not found cache" in proxy repositories.  This can result in very slow build times.

      Reproduce case:

      1. Set up a stock Nexus 3.12.1 instance. 
      2. Go to "support/logging" and set the org.sonatype.nexus.httpclient.outbound logger to DEBUG
      3. Fire the following request to the server:

       

      curl --head [http://localhost:8081/repository/maven-public/ant/ant/1.2.3/ant-1.2.3.pom

      Observer the following log entries appear:

      2018-07-06 12:50:41,413-0500 DEBUG [qtp1103723930-228] *UNKNOWN org.sonatype.nexus.httpclient.outbound - https://repo1.maven.org/maven2/ant/ant/1.2.3/ant-1.2.3.pom > GET /maven2/ant/ant/1.2.3/ant-1.2.3.pom HTTP/1.1
      2018-07-06 12:50:41,638-0500 DEBUG [qtp1103723930-228] *UNKNOWN org.sonatype.nexus.httpclient.outbound - https://repo1.maven.org/maven2/ant/ant/1.2.3/ant-1.2.3.pom < HTTP/1.1 404 Not Found @ 224.1 ms

       Now fire the same curl request again.  The outbound loggers are again seen.

      If you fire the request as a GET request you'll only see one outbound request, subsequent requests will not go outbound.

      I checked using Charles Proxy, and the outbound request made is always a GET request, regardless of whether the inbound request is HEAD or GET. So I am surprised to see a difference in NFC handling.

      Expected: NFC should be populated in proxy repositories for inbound HEAD requests.

      Note: I also tested this in the latest 3.13.0 snapshot, the same behavior is observed.

       

       

       

      Attachments

        Activity

          People

            natemcafee Nate McAfee [X] (Inactive)
            rseddon Rich Seddon
            Peter Lynch Peter Lynch
            Nexus - Core
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              tigCommentSecurity.panel-title