From 354278d488081fa981d1387fa8f3e977feb6376c Mon Sep 17 00:00:00 2001 From: andreimarcu Date: Sat, 10 Oct 2015 11:22:24 -0400 Subject: [PATCH] Real-IP middleware for fastcgi + nginx doc update --- README.md | 2 ++ server.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 924480c..ebdc9a8 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ server { client_max_body_size 4096M; location / { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; fastcgi_pass 127.0.0.1:8080; include fastcgi_params; } diff --git a/server.go b/server.go index caa93a2..252babd 100644 --- a/server.go +++ b/server.go @@ -48,6 +48,10 @@ func setup() *web.Mux { // middleware mux.Use(middleware.RequestID) + if Config.fastcgi { + mux.Use(middleware.RealIP) + } + if !Config.noLogs { mux.Use(middleware.Logger) }