diff --git a/core/src/main/java/org/restheart/services/PingService.java b/core/src/main/java/org/restheart/services/PingService.java index ae6a64c10..c2e4dc30e 100644 --- a/core/src/main/java/org/restheart/services/PingService.java +++ b/core/src/main/java/org/restheart/services/PingService.java @@ -56,6 +56,8 @@ public void handle(final ByteArrayRequest request, final ByteArrayResponse respo .append(msg) .append("\", \"client_ip\": \"") .append(getClientIp(request.getExchange())) + .append("\", \"host\": \"") + .append(getHostHeader(request.getExchange())) .append("\"}"); final String pingMessage = pingMessageBuilder.toString(); response.setContentType("application/json"); @@ -67,6 +69,10 @@ public void handle(final ByteArrayRequest request, final ByteArrayResponse respo } } + private String getHostHeader(final HttpServerExchange exchange) { + return exchange.getRequestHeaders().getFirst("Host"); + } + private String getClientIp(final HttpServerExchange exchange) { // Get the X-Forwarded-For header from the request final String forwardedFor = exchange.getRequestHeaders().getFirst("X-Forwarded-For");