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.
- Set up a stock Nexus 3.12.1 instance.
- Go to "support/logging" and set the org.sonatype.nexus.httpclient.outbound logger to DEBUG
- 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.