From ef8a65594ab25721e0d44a9c7b85bd421c6d5e79 Mon Sep 17 00:00:00 2001 From: George Shammas Date: Sat, 10 Apr 2021 09:36:08 -0400 Subject: [PATCH] Add support for chained X-Forwarded-For headers --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index d802eab..2d0c450 100644 --- a/main.go +++ b/main.go @@ -80,7 +80,7 @@ func mainHandler(c *gin.Context) { c.Abort() } - header_ip := net.ParseIP(c.Request.Header.Get(configuration.ipheader)) + header_ip := net.ParseIP(strings.Split(c.Request.Header.Get(configuration.ipheader), ",")[0]) if header_ip != nil { ip.IP = header_ip }