diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedParser.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedParser.java index 6fe05d63185aa..0bdee036fbf3b 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedParser.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedParser.java @@ -140,7 +140,7 @@ private void calculate() { matcher = FORWARDED_FOR_PATTERN.matcher(forwarded); if (matcher.find()) { - remoteAddress = parseFor(matcher.group(1).trim(), remoteAddress.port()); + remoteAddress = parseFor(matcher.group(1).trim(), remoteAddress != null ? remoteAddress.port() : port); } } else if (forwardingProxyOptions.allowXForwarded) { String protocolHeader = delegate.getHeader(X_FORWARDED_PROTO); @@ -177,7 +177,7 @@ private void calculate() { String forHeader = delegate.getHeader(X_FORWARDED_FOR); if (forHeader != null) { - remoteAddress = parseFor(getFirstElement(forHeader), remoteAddress.port()); + remoteAddress = parseFor(getFirstElement(forHeader), remoteAddress != null ? remoteAddress.port() : port); } } }