Fix invalid baseurl if host header already contains port (#2005)

This commit is contained in:
InfiniteTF
2021-11-14 21:50:42 +01:00
committed by GitHub
parent df7d1427d6
commit 2a5afecc77

View File

@@ -352,7 +352,7 @@ func BaseURLMiddleware(next http.Handler) http.Handler {
port := "" port := ""
forwardedPort := r.Header.Get("X-Forwarded-Port") forwardedPort := r.Header.Get("X-Forwarded-Port")
if forwardedPort != "" && forwardedPort != "80" && forwardedPort != "8080" { if forwardedPort != "" && forwardedPort != "80" && forwardedPort != "8080" && forwardedPort != "443" && !strings.Contains(r.Host, ":") {
port = ":" + forwardedPort port = ":" + forwardedPort
} }