Browse Source

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

pull/6705/head
zuzuviewer 2 weeks ago
committed by GitHub
parent
commit
396a602f86
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      weed/s3api/auth_signature_v4.go

6
weed/s3api/auth_signature_v4.go

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

Loading…
Cancel
Save