* Fix s3 auth failed with X-Forwarded-Host and X-Forwarded-Port (#6698)

This commit is contained in:
zuzuviewer
2025-04-09 12:26:19 +08:00
committed by GitHub
parent 2e0e5c09cd
commit 396a602f86

View File

@@ -732,7 +732,7 @@ func extractHostHeader(r *http.Request) string {
}
}
if !isDefaultPort(r.URL.Scheme, forwardedPort) {
extractedHost = net.JoinHostPort(forwardedHost, forwardedPort)
extractedHost = net.JoinHostPort(extractedHost, forwardedPort)
}
return extractedHost
} else {
@@ -743,12 +743,12 @@ func extractHostHeader(r *http.Request) string {
}
h, port, err := net.SplitHostPort(host)
if err != nil {
return r.Host
return host
}
if isDefaultPort(r.URL.Scheme, port) {
return h
}
return r.Host
return host
}
}