fix(hub): check X-Real-IP header to resolve agent's real source IP (#1973)

This commit is contained in:
Sven van Ginkel
2026-08-14 16:13:26 +02:00
committed by GitHub
parent bc55e249c4
commit 6607d4c0d6
2 changed files with 21 additions and 0 deletions

View File

@@ -317,6 +317,9 @@ func getRealIP(r *http.Request) string {
if ip := r.Header.Get("CF-Connecting-IP"); ip != "" {
return ip
}
if ip := r.Header.Get("X-Real-IP"); ip != "" {
return ip
}
if ip := r.Header.Get("X-Forwarded-For"); ip != "" {
// X-Forwarded-For can contain a comma-separated list: "client_ip, proxy1, proxy2"
// Take the first one