From 172585dbe309c78439f2f07ee749a194f4762fd0 Mon Sep 17 00:00:00 2001 From: Buzz2d0 Date: Wed, 15 Dec 2021 10:27:52 +0800 Subject: [PATCH] Fix getRealIP --- hyuga/handler/oob/http.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hyuga/handler/oob/http.go b/hyuga/handler/oob/http.go index 23e1a7b..01ed764 100644 --- a/hyuga/handler/oob/http.go +++ b/hyuga/handler/oob/http.go @@ -39,14 +39,14 @@ func HttpLog(c *gin.Context) { } func getRealIP(r *http.Request) string { - ip := r.Header.Get("X-Real-Ip") + ip := r.Header.Get("X-Real-IP") if ip == "" { ip = r.Header.Get("X-Forwarded-For") } if ip == "" { ip = r.RemoteAddr } - return ip + return strings.Split(ip, ":")[0] } func getIdentity(domain, sub string) string {