diff --git a/metrics/core/src/main/java/org/hyperledger/besu/metrics/prometheus/MetricsHttpService.java b/metrics/core/src/main/java/org/hyperledger/besu/metrics/prometheus/MetricsHttpService.java index d9202d1dd7..06d32ca21b 100644 --- a/metrics/core/src/main/java/org/hyperledger/besu/metrics/prometheus/MetricsHttpService.java +++ b/metrics/core/src/main/java/org/hyperledger/besu/metrics/prometheus/MetricsHttpService.java @@ -149,7 +149,11 @@ class MetricsHttpService implements MetricsService { } private Optional getAndValidateHostHeader(final RoutingContext event) { - final Iterable splitHostHeader = Splitter.on(':').split(event.request().host()); + final String hostHeader = event.request().host(); + if (hostHeader == null) { + return Optional.empty(); + } + final Iterable splitHostHeader = Splitter.on(':').split(hostHeader); final long hostPieces = stream(splitHostHeader).count(); if (hostPieces > 1) { // If the host contains a colon, verify the host is correctly formed - host [ ":" port ]