diff --git a/README.md b/README.md index 704a88a..832a9e2 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/templates/http/default.conf.j2 b/templates/http/default.conf.j2 index 13d728d..480efdd 100644 --- a/templates/http/default.conf.j2 +++ b/templates/http/default.conf.j2 @@ -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 %} diff --git a/tests/playbooks/nginx-http-template.yml b/tests/playbooks/nginx-http-template.yml index 6dc169e..088b1ab 100644 --- a/tests/playbooks/nginx-http-template.yml +++ b/tests/playbooks/nginx-http-template.yml @@ -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