mirror of
https://github.com/labstack/echo.git
synced 2024-12-24 20:14:31 +02:00
Fixed Context#RealIP() to fetch the first IP
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
a87261ecb2
commit
ac0a38d995
@ -231,7 +231,7 @@ func (c *context) Scheme() string {
|
||||
func (c *context) RealIP() string {
|
||||
ra := c.request.RemoteAddr
|
||||
if ip := c.request.Header.Get(HeaderXForwardedFor); ip != "" {
|
||||
ra = ip
|
||||
ra = strings.Split(ip, ", ")[0]
|
||||
} else if ip := c.request.Header.Get(HeaderXRealIP); ip != "" {
|
||||
ra = ip
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user