summary refs log tree commit diff stats
path: root/http.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-26 01:48:12 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-26 02:05:59 -0400
commita6f47c07100be337f32325792990e58f5f4a3506 (patch)
tree309a35b47d4a900a9e02bc8bf48acb8296e10d93 /http.go
parente1e68aa2ba2992543603cfd5a4e1fa2e4eaeeb72 (diff)
downloadgetwtxt-a6f47c07100be337f32325792990e58f5f4a3506.tar.gz
simplified indexHandler to reference staticCache
sending ETag with all GET responses: sha256 of raw bytes
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]
 	}