adding wrapper for proxy header passing.

add a selection to the proxy editing page and passes that down into the templates.
Removed set_proxy_header from locations and moved to server directive. these will inherit down into locations if they are not defined there.
This commit is contained in:
Nick Craig
2022-03-09 10:19:51 -05:00
parent 7f2d59a4f1
commit c571599d45
9 changed files with 82 additions and 24 deletions

View File

@@ -1,9 +1,4 @@
location {{ path }} {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass {{ forward_scheme }}://{{ forward_host }}:{{ forward_port }}{{ forward_path }};
{% if access_list_id > 0 %}
@@ -33,13 +28,6 @@
{% include "_forced_ssl.conf" %}
{% include "_hsts.conf" %}
{% if allow_websocket_upgrade == 1 or allow_websocket_upgrade == true %}
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
{% endif %}
{{ advanced_config }}
}

View File

@@ -24,6 +24,20 @@ proxy_http_version 1.1;
{{ advanced_config }}
# Proxy!
{% if forward_proxy_header == 1 or forward_proxy_header == true %}
proxy_set_header Host $host;
{% else %}
proxy_set_header Host $proxy_host;
{% endif %}
include conf.d/include/proxy.conf;
{% if allow_websocket_upgrade == 1 or allow_websocket_upgrade == true %}
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
{% endif %}
{{ locations }}
{% if use_default_location %}
@@ -51,15 +65,6 @@ proxy_http_version 1.1;
{% endif %}
{% if allow_websocket_upgrade == 1 or allow_websocket_upgrade == true %}
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
{% endif %}
# Proxy!
include conf.d/include/proxy.conf;
}
{% endif %}