🎨优化
This commit is contained in:
parent
2c96984490
commit
32f61a0eef
@ -52,8 +52,8 @@ func RequestLog() gin.HandlerFunc {
|
||||
method := c.Request.Method // 请求方式
|
||||
ip := c.ClientIP() // 取出IP
|
||||
// 处理实际客户端IP
|
||||
if c.Request.Header.Get("X-Real-IP") != "" {
|
||||
ip = c.Request.Header.Get("X-Real-IP") // 这个是网关Nginx自定义的Header头
|
||||
if c.Request.Header.Get("X-Real-Ip") != "" {
|
||||
ip = c.Request.Header.Get("X-Real-Ip") // 这个是网关Nginx自定义的Header头
|
||||
} else if c.Request.Header.Get("X-Forwarded-For") != "" {
|
||||
ip = c.Request.Header.Get("X-Forwarded-For") // 这个是网关Nginx自定义的Header头
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user