fixed handling of X-Forwarded-For, removed X-Real-IP stuff

This commit is contained in:
Joachim Lusiardi 2016-12-30 14:42:31 +01:00
parent f01cca999f
commit ca543dcb5b
1 changed files with 6 additions and 4 deletions

View File

@ -18,8 +18,9 @@ server {
location / { location / {
client_max_body_size $body_size; client_max_body_size $body_size;
client_body_timeout 300s; client_body_timeout 300s;
proxy_set_header X-Real-IP $$remote_addr; if ($$http_x_forwarded_for = "") {
proxy_set_header X-Forwarded-For $$remote_addr; add_header X-Forwarded-For $$remote_addr;
}
proxy_set_header Host $$host; proxy_set_header Host $$host;
proxy_pass http://$ip:$port/; proxy_pass http://$ip:$port/;
} }
@ -36,8 +37,9 @@ server {
location /$location { location /$location {
client_max_body_size $body_size; client_max_body_size $body_size;
client_body_timeout 300s; client_body_timeout 300s;
proxy_set_header X-Real-IP $$remote_addr; if ($$http_x_forwarded_for = "") {
proxy_set_header X-Forwarded-For $$remote_addr; add_header X-Forwarded-For $$remote_addr;
}
proxy_set_header Host $$host; proxy_set_header Host $$host;
proxy_pass http://$ip:$port/; proxy_pass http://$ip:$port/;
} }