Add support for multiple rewrite directives as per nginx conf (#176)

This commit is contained in:
scodeman 2019-11-05 06:41:25 +08:00 committed by Alessandro Fael Garcia
parent 41aeda300d
commit 7785babce1
3 changed files with 8 additions and 4 deletions

View File

@ -490,7 +490,8 @@ nginx_http_template:
#always: false
proxy_connect_timeout: null
proxy_pass: http://backend
#rewrite: /foo(.*) /$1 break
#rewrites:
# - /foo(.*) /$1 break
#proxy_pass_request_body: off
#allows:
# - 192.168.1.0/24

View File

@ -304,7 +304,8 @@ nginx_http_template:
#always: false
proxy_connect_timeout: null
proxy_pass: http://backend
#rewrite: /foo(.*) /$1 break
#rewrites:
# - /foo(.*) /$1 break
#proxy_pass_request_body: off
#allows:
# - 192.168.1.0/24

View File

@ -196,8 +196,10 @@ server {
proxy_connect_timeout {{ item.value.reverse_proxy.locations[location].proxy_connect_timeout }};
{% endif %}
proxy_pass {{ item.value.reverse_proxy.locations[location].proxy_pass }};
{% if item.value.reverse_proxy.locations[location].rewrite is defined %}
rewrite {{ item.value.reverse_proxy.locations[location].rewrite }};
{% if item.value.reverse_proxy.locations[location].rewrites is defined %}
{% for rewrite in item.value.reverse_proxy.locations[location].rewrites %}
rewrite {{ rewrite }};
{% endfor %}
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_read_timeout is defined and item.value.reverse_proxy.locations[location].proxy_read_timeout %}
proxy_read_timeout {{ item.value.reverse_proxy.locations[location].proxy_read_timeout }};