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)