mirror of
https://github.com/sipeed/NanoKVM.git
synced 2026-09-11 00:22:56 -05:00
fix ipv6
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user