Add proxy_redirect parameter for location blocks (#102)

* Add proxy_redirect parameter for http and location blocks (#1)

* Use ternary() filter to handle proxy_redirect parameter
This commit is contained in:
Alexander Rublev 2019-02-18 21:23:57 +07:00 committed by Grzegorz Dzien
parent 589d668def
commit 469d663bc2
3 changed files with 6 additions and 1 deletions

View File

@ -374,6 +374,7 @@ nginx_http_template:
proxy_ignore_headers:
- Vary
- Cache-Control
proxy_redirect: false
websocket: false
auth_basic: null
auth_basic_file: null

View File

@ -75,7 +75,9 @@ server {
auth_basic_user_file {{ item.value.reverse_proxy.locations[location].auth_basic_file }};
{% endif %}
proxy_pass {{ item.value.reverse_proxy.locations[location].proxy_pass }};
{% if item.value.reverse_proxy.locations[location].proxy_redirect is defined %}
proxy_redirect {{ item.value.reverse_proxy.locations[location].proxy_redirect | ternary(item.value.reverse_proxy.locations[location].proxy_redirect, "off") }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_cache is defined %}
proxy_cache {{ item.value.reverse_proxy.locations[location].proxy_cache }};
{% endif %}

View File

@ -59,6 +59,7 @@
proxy_ignore_headers:
- Vary
- Cache-Control
proxy_redirect: false
backend:
location: /backend
proxy_pass: http://backend_servers/
@ -72,6 +73,7 @@
- http_500
- http_502
- http_503
proxy_redirect: default
upstreams:
frontend_upstream:
name: frontend_servers