diff --git a/app.go b/app.go index 8a776af4..66b6ef5c 100644 --- a/app.go +++ b/app.go @@ -954,9 +954,14 @@ func (app *App) startupMessage(addr string, tls bool, pids string) { host, port := parseAddr(addr) if host == "" { - host = "0.0.0.0" + if app.config.Network == NetworkTCP6 { + host = "[::1]" + } else { + host = "0.0.0.0" + } } + scheme := "http" if tls { scheme = "https" diff --git a/helpers_test.go b/helpers_test.go index 291d49a0..4597e37f 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -194,7 +194,7 @@ func Test_Utils_Parse_Address(t *testing.T) { testCases := []struct { addr, host, port string }{ - {"[::]:3000", "[::]", "3000"}, + {"[::1]:3000", "[::1]", "3000"}, {"127.0.0.1:3000", "127.0.0.1", "3000"}, {"/path/to/unix/socket", "/path/to/unix/socket", ""}, } diff --git a/prefork_test.go b/prefork_test.go index 73c92b53..0f879b98 100644 --- a/prefork_test.go +++ b/prefork_test.go @@ -31,7 +31,7 @@ func Test_App_Prefork_Child_Process(t *testing.T) { utils.AssertEqual(t, nil, app.Shutdown()) }() - utils.AssertEqual(t, nil, app.prefork(NetworkTCP6, "[::]:", nil)) + utils.AssertEqual(t, nil, app.prefork(NetworkTCP6, "[::1]:", nil)) // Create tls certificate cer, err := tls.LoadX509KeyPair("./.github/testdata/ssl.pem", "./.github/testdata/ssl.key")