From 1b28b196a0dcb6adab720507f25a19b4a2dd8323 Mon Sep 17 00:00:00 2001 From: coward Date: Wed, 21 Aug 2024 16:39:30 +0800 Subject: [PATCH] =?UTF-8?q?:art:=E6=89=93=E5=8D=B0=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=9C=8B=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- http/middleware/request.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/http/middleware/request.go b/http/middleware/request.go index 00e15e0..ee456bb 100644 --- a/http/middleware/request.go +++ b/http/middleware/request.go @@ -59,6 +59,8 @@ func RequestLog() gin.HandlerFunc { } ua := c.Request.UserAgent() // UA + log.Debugf("真实IP是: %v === clientIP是: %v", c.Request.Header.Get("X-Real-Ip"), ip) + // 重写客户端IP c.Request.Header.Set("X-Forwarded-For", ip) c.Request.Header.Set("X-Real-IP", ip)