Skip to content

Commit

Permalink
caddyhttp: Print actual listener address in log message (closes #2992)
Browse files Browse the repository at this point in the history
Needed if port is 0, thus chosen by OS
  • Loading branch information
mholt committed Apr 1, 2020
1 parent 0d2a351 commit 581f1de
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion modules/caddyhttp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,17 @@ func (app *App) Start() error {
ln = srv.listenerWrappers[i].WrapListener(ln)
}

// if binding to port 0, the OS chooses a port for us;
// but the user won't know the port unless we print it
if listenAddr.StartPort == 0 && listenAddr.EndPort == 0 {
app.logger.Info("port 0 listener",
zap.String("input_address", lnAddr),
zap.String("actual_address", ln.Addr().String()),
)
}

app.logger.Debug("starting server loop",
zap.String("address", lnAddr),
zap.String("address", ln.Addr().String()),
zap.Bool("http3", srv.ExperimentalHTTP3),
zap.Bool("tls", useTLS),
)
Expand Down

0 comments on commit 581f1de

Please sign in to comment.