From 731c27cc5ba60a93b28d84453bc2e4a5d581867c Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 14 Oct 2016 17:24:20 +0200 Subject: [PATCH] library/roles/nginx/templates/nginx-proxy-params.conf.j2: Some proxy statements must be conditional to the presence of an haproxy load balancer. --- nginx/templates/nginx-proxy-params.conf.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nginx/templates/nginx-proxy-params.conf.j2 b/nginx/templates/nginx-proxy-params.conf.j2 index 68ffc909..f8cb3b00 100644 --- a/nginx/templates/nginx-proxy-params.conf.j2 +++ b/nginx/templates/nginx-proxy-params.conf.j2 @@ -1,10 +1,14 @@ # Proxy stuff # include /etc/nginx/snippets/nginx-proxy-params.conf; proxy_http_version 1.1; +{% if haproxy_ips is defined %} proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Host $remote_addr; 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-Proto $scheme; proxy_buffering {{ nginx_proxy_buffering }};