This commit is contained in:
Javier Provecho Fernandez
2016-12-05 11:21:59 +01:00
parent 18392f589f
commit 7e58c80a7c
4 changed files with 30 additions and 0 deletions
+8
View File
@@ -353,9 +353,17 @@ func (c *Context) ClientIP() string {
return clientIP
}
}
if c.engine.AppEngine {
if addr := c.Request.Header.Get("X-Appengine-Remote-Addr"); addr != "" {
return addr
}
}
if ip, _, err := net.SplitHostPort(strings.TrimSpace(c.Request.RemoteAddr)); err == nil {
return ip
}
return ""
}