Nexus 3.41.0 NPE error when using docker proxy without supplying Host header

Hello there,

We are running nexus as a docker proxy for docker hub, and are experiencing NullPointerExceptions when we try to pull images though the proxy.

`*SYSTEM org.eclipse.jetty.server.HttpChannel - /v2/
java.lang.NullPointerException: null
	at org.sonatype.nexus.bootstrap.jetty.DockerSubdomainRepositoryMapping.get(DockerSubdomainRepositoryMapping.java:27)
	at org.sonatype.nexus.bootstrap.jetty.DockerSubdomainRequestCustomizer.customize(DockerSubdomainRequestCustomizer.java:35)
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:384)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:386)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
	at java.lang.Thread.run(Thread.java:750)

Hi Richard,
Sorry for this experience. It appears that there are two issues here:

  • Nexus Repository should handle this case gracefully - I’ll raise this with the team internally
  • You are not using any type of connector (HTTP, HTTPS, or Subdomain Connector) to access content in your repository - please check our documentation about Docker registries