summary refs log tree commit diff stats
path: root/http.go
diff options
context:
space:
mode:
Diffstat (limited to 'http.go')
-rw-r--r--http.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/http.go b/http.go
index fcce0a7..de9eb3b 100644
--- a/http.go
+++ b/http.go
@@ -22,8 +22,9 @@ func newCtxUserIP(ctx context.Context, r *http.Request) context.Context {
 		uip = base[0]
 	}
 
-	if _, ok := r.Header["X-Real-IP"]; ok {
-		proxied := r.Header["X-Real-IP"]
+	xRealIP := http.CanonicalHeaderKey("X-Real-IP")
+	if _, ok := r.Header[xRealIP]; ok {
+		proxied := r.Header[xRealIP]
 		base = strings.Split(proxied[len(proxied)-1], ":")
 		uip = base[0]
 	}