[relay] Handle IPv6 addresses in X-Real-IP header on relay service (#3085)

This commit is contained in:
Joakim Nohlgård 2025-01-06 17:31:35 +01:00 committed by GitHub
parent 6848e1e128
commit 2bd68efc08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -96,5 +96,5 @@ func remoteAddr(r *http.Request) string {
if r.Header.Get("X-Real-Ip") == "" || r.Header.Get("X-Real-Port") == "" { if r.Header.Get("X-Real-Ip") == "" || r.Header.Get("X-Real-Port") == "" {
return r.RemoteAddr return r.RemoteAddr
} }
return fmt.Sprintf("%s:%s", r.Header.Get("X-Real-Ip"), r.Header.Get("X-Real-Port")) return net.JoinHostPort(r.Header.Get("X-Real-Ip"), r.Header.Get("X-Real-Port"))
} }