Skip to content

Commit

Permalink
Bind HTTP server to all interfaces if listener host is empty (#59)
Browse files Browse the repository at this point in the history
Signed-off-by: Mickael Maison <[email protected]>
  • Loading branch information
mimaison authored Nov 4, 2024
1 parent 5c5197e commit d8b9540
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/java/io/strimzi/kafka/metrics/http/HttpServers.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ public static class ServerCounter {

private ServerCounter(Listener listener, PrometheusRegistry registry) throws IOException {
this.count = new AtomicInteger();
this.server = HTTPServer.builder()
.hostname(listener.host)
HTTPServer.Builder builder = HTTPServer.builder()
.port(listener.port)
.registry(registry)
.buildAndStart();
.registry(registry);
if (!listener.host.isEmpty()) {
builder.hostname(listener.host);
}
this.server = builder.buildAndStart();
LOG.debug("Started HTTP server on http://{}:{}", listener.host, server.getPort());
this.listener = listener;
}
Expand Down

0 comments on commit d8b9540

Please sign in to comment.