Compare commits

...

2 Commits

Author SHA1 Message Date
Eric Lindvall
d4bec2aaa2
Merge df1c72fe4123e0ae14141e359b5eaf1edf9b2266 into d1a15347b1e45a8ee816193d3578a93bfd73b70f 2025-12-22 03:06:13 +08:00
Eric Lindvall
df1c72fe41 Fix logging of IPv6 addresses with scope 2022-01-19 19:21:46 -08:00

View File

@ -981,9 +981,10 @@ func (c *Context) ClientIP() string {
// It also checks if the remoteIP is a trusted proxy or not.
// In order to perform this validation, it will see if the IP is contained within at least one of the CIDR blocks
// defined by Engine.SetTrustedProxies()
// If the IP could not be parsed (because, for instance, it is an ipv6 address with a scope), it will return the remote IP as-is.
remoteIP := net.ParseIP(c.RemoteIP())
if remoteIP == nil {
return ""
return c.RemoteIP()
}
trusted := c.engine.isTrustedProxy(remoteIP)