Add support for not passing host header to proxy upstream
This commit is contained in:
@@ -15,6 +15,7 @@ vhost_proxy_target_netproto: tcp
|
||||
vhost_proxy_target_protocol: http
|
||||
vhost_proxy_target_host: localhost
|
||||
vhost_proxy_delete_headers: []
|
||||
vhost_proxy_pass_host_header: true
|
||||
|
||||
vhost_redirect_type: temporary
|
||||
vhost_redirect_preserve_path: false
|
||||
|
||||
@@ -109,6 +109,11 @@ argument_specs:
|
||||
elements: str
|
||||
required: false
|
||||
default: []
|
||||
vhost_proxy_pass_host_header:
|
||||
description: Whether to pass the host header unchanged (true) or change it to the proxy target host (false)
|
||||
trpe: bool
|
||||
required: false
|
||||
default: true
|
||||
|
||||
vhost_redirect_target:
|
||||
description: "Only applicable if vhost_type is redirect. Example: https://www.domain.tld/location"
|
||||
@@ -230,6 +235,11 @@ argument_specs:
|
||||
elements: str
|
||||
required: false
|
||||
default: "{{ vhost_proxy_delete_headers }}"
|
||||
proxy_pass_host_header:
|
||||
description: Whether to pass the host header unchanged (true) or change it to the proxy target host (false)
|
||||
trpe: bool
|
||||
required: false
|
||||
default: "{{ vhost_proxy_pass_host_header }}"
|
||||
|
||||
redirect_target:
|
||||
description: "Only applicable if vhost_type is redirect. Example: https://www.domain.tld/location"
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
{% for header in location.proxy_delete_headers %}
|
||||
header_up -{{ header }}
|
||||
{% endfor %}
|
||||
{% if not location.proxy_pass_host_header %}
|
||||
header_up Host {upstream_hostport}
|
||||
{% endif %}
|
||||
}
|
||||
{% elif location.type == 'redirect' %}
|
||||
redir * {{ location.redirect_target }}{{ '{path}' if location.redirect_preserve_path }}{{ '?{query}' if location.redirect_preserve_query }} {{ location.redirect_type }}
|
||||
|
||||
@@ -15,6 +15,7 @@ _vhost_location_defaults:
|
||||
proxy_target_socket: "{{ vhost_proxy_target_socket if
|
||||
vhost_type == 'reverse_proxy' and vhost_proxy_target_netproto == 'unix' else '' }}"
|
||||
proxy_delete_headers: "{{ vhost_proxy_delete_headers }}"
|
||||
proxy_pass_host_header: "{{ vhost_proxy_pass_host_header }}"
|
||||
|
||||
redirect_target: "{{ vhost_redirect_target if vhost_type == 'redirect' else '' }}"
|
||||
redirect_preserve_path: "{{ vhost_redirect_preserve_path }}"
|
||||
|
||||
Reference in New Issue
Block a user