library/roles/nginx/templates/nginx-proxy-params.conf.j2: Some proxy statements must be conditional to the presence of an haproxy load balancer.

This commit is contained in:
Andrea Dell'Amico 2016-10-14 17:24:20 +02:00
parent 68191f9571
commit 731c27cc5b
1 changed files with 4 additions and 0 deletions

View File

@ -1,10 +1,14 @@
# Proxy stuff # Proxy stuff
# include /etc/nginx/snippets/nginx-proxy-params.conf; # include /etc/nginx/snippets/nginx-proxy-params.conf;
proxy_http_version 1.1; proxy_http_version 1.1;
{% if haproxy_ips is defined %}
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $remote_addr; proxy_set_header X-Forwarded-Host $remote_addr;
proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-Server $host;
{% else %}
proxy_set_header Host $host;
{% endif %}
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering {{ nginx_proxy_buffering }}; proxy_buffering {{ nginx_proxy_buffering }};