nginx_proxy_define_header_host

This commit is contained in:
Andrea Dell'Amico 2021-05-28 19:00:52 +02:00
parent db109326d8
commit 1cc1f240bb
Signed by: adellam
GPG Key ID: 147ABE6CEB9E20FF
2 changed files with 5 additions and 0 deletions

View File

@ -57,6 +57,7 @@ nginx_css_js_cache_expire: -1
nginx_reverse_proxy: False nginx_reverse_proxy: False
nginx_define_x_real_ip: False nginx_define_x_real_ip: False
nginx_proxy_define_header_host: True
nginx_set_original_uri: True nginx_set_original_uri: True
nginx_proxy_buffering: "on" nginx_proxy_buffering: "on"
nginx_proxy_redirect: "off" nginx_proxy_redirect: "off"

View File

@ -3,14 +3,18 @@
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Connection ""; proxy_set_header Connection "";
{% if haproxy_ips is defined %} {% if haproxy_ips is defined %}
{% if not nginx_proxy_define_header_host %}
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
{% endif %}
{% if nginx_behind_haproxy_settings %} {% if nginx_behind_haproxy_settings %}
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host {{ nginx_x_forwarded_host }}; proxy_set_header X-Forwarded-Host {{ nginx_x_forwarded_host }};
proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-Server $host;
{% endif %} {% endif %}
{% else %} {% else %}
{% if not nginx_proxy_define_header_host %}
proxy_set_header Host $host; proxy_set_header Host $host;
{% endif %}
{% if nginx_define_x_real_ip %} {% if nginx_define_x_real_ip %}
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
{% endif %} {% endif %}