This commit is contained in:
Kirill Nikiforov
2026-04-16 00:51:02 +04:00
parent 64681e2aac
commit 7f3d29eba2
6 changed files with 21 additions and 9 deletions

View File

@@ -38,8 +38,12 @@ func ListenAndServeLoopbackHTTPRedirect(
if h, _, err := net.SplitHostPort(host); err == nil {
host = h
}
if strings.Contains(host, ":") {
host = "[" + host + "]"
}
if httpsPort != "443" {
host = net.JoinHostPort(host, httpsPort)
host += ":" + httpsPort
}
http.Redirect(w, req, "https://"+host+req.URL.RequestURI(), http.StatusTemporaryRedirect)