fix: bracket IPv6 addresses in auto-detected webui gateway URLs

Use net.JoinHostPort instead of manual string formatting in
buildServiceURLs so IPv6 addresses are properly wrapped in brackets.
This fixes malformed URLs like "http://::1:7070" being presented as
the default server URL in the WebUI login form when listening on an
IPv6 address; they now correctly render as "http://[::1]:7070".

Fixes #1926
This commit is contained in:
Ben McClelland
2026-03-04 09:43:47 -08:00
parent 703baeeed4
commit 8534d2829f
+1 -1
View File
@@ -1506,7 +1506,7 @@ func buildServiceURLs(spec string, ssl bool) ([]string, error) {
}
urls := make([]string, 0, len(interfaces))
for _, ip := range interfaces {
urls = append(urls, fmt.Sprintf("%s://%s:%s", scheme, ip, prt))
urls = append(urls, fmt.Sprintf("%s://%s", scheme, net.JoinHostPort(ip, prt)))
}
return urls, nil
}