From 78c7101ff6d416d3c26742832beb089d3f006b9a Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Mon, 18 Aug 2014 04:52:01 +0200 Subject: [PATCH] Check existence of X-Forwarded-For by comparing the length --- logger.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/logger.go b/logger.go index 5a67f7c2..2667d131 100644 --- a/logger.go +++ b/logger.go @@ -44,12 +44,12 @@ func Logger() HandlerFunc { // save the IP of the requester requester := c.Request.Header.Get("X-Real-IP") // if the requester-header is empty, check the forwarded-header - if requester == "" { + if len(requester) == 0 { requester = c.Request.Header.Get("X-Forwarded-For") } // if the requester is still empty, use the hard-coded address from the socket - if requester == "" { + if len(requester) == 0 { requester = c.Request.RemoteAddr }