@marcel91200 / caddy Mirror · read-only / commits / 581f1def
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

caddyhttp: Print actual listener address in log message (closes #2992)

Needed if port is 0, thus chosen by OS

Matthew Holt committed Apr 1, 2020 at 12:23 UTC 581f1defcb6de580d57f3c3e58b29950d2f42cb7
1 file changed +10 -1
modules/caddyhttp/app.go
+10 -1
@@ -345,8 +345,17 @@ func (app *App) Start() error {
345 ln = srv.listenerWrappers[i].WrapListener(ln)
346 }
347
348 + // if binding to port 0, the OS chooses a port for us;
349 + // but the user won't know the port unless we print it
350 + if listenAddr.StartPort == 0 && listenAddr.EndPort == 0 {
351 + app.logger.Info("port 0 listener",
352 + zap.String("input_address", lnAddr),
353 + zap.String("actual_address", ln.Addr().String()),
354 + )
355 + }
356 +
357 app.logger.Debug("starting server loop",
349 - zap.String("address", lnAddr),
358 + zap.String("address", ln.Addr().String()),
359 zap.Bool("http3", srv.ExperimentalHTTP3),
360 zap.Bool("tls", useTLS),
361 )