Real-IP middleware for fastcgi + nginx doc update

This commit is contained in:
andreimarcu 2015-10-10 11:22:24 -04:00
parent ef13181a23
commit 354278d488
2 changed files with 6 additions and 0 deletions

View File

@ -48,6 +48,8 @@ server {
client_max_body_size 4096M; client_max_body_size 4096M;
location / { 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; fastcgi_pass 127.0.0.1:8080;
include fastcgi_params; include fastcgi_params;
} }

View File

@ -48,6 +48,10 @@ func setup() *web.Mux {
// middleware // middleware
mux.Use(middleware.RequestID) mux.Use(middleware.RequestID)
if Config.fastcgi {
mux.Use(middleware.RealIP)
}
if !Config.noLogs { if !Config.noLogs {
mux.Use(middleware.Logger) mux.Use(middleware.Logger)
} }