omit http and https ports when using X-Forwarded-Port (#6527)

This commit is contained in:
Tom Crasset
2025-02-07 19:55:09 +01:00
committed by GitHub
parent a7b964af96
commit 9ca2b0b763

View File

@@ -711,7 +711,7 @@ func extractHostHeader(r *http.Request) string {
// If X-Forwarded-Port is set, use that too to form the host.
if forwardedHost != "" {
extractedHost := forwardedHost
if forwardedPort != "" {
if forwardedPort != "" && forwardedPort != "80" && forwardedPort != "443" {
extractedHost = forwardedHost + ":" + forwardedPort
}
return extractedHost