nginx配置 作用就是在反向代理的时候,将用户ip设置到请求头中 location / { proxy_set_header X-Forward-For $remote_addr; proxy_set_header X-real-ip $remote_addr; proxy_pass http://xxxxxx; } gin的某个版本有bug? c.ClientIP()获取的还是127.0.0.1 我们可以用c.Request.Header.Get("X-Forward-For")获取