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 #always: false
proxy_connect_timeout: null proxy_connect_timeout: null
proxy_pass: http://backend proxy_pass: http://backend
#rewrite: /foo(.*) /$1 break #rewrites:
# - /foo(.*) /$1 break
#proxy_pass_request_body: off #proxy_pass_request_body: off
#allows: #allows:
# - 192.168.1.0/24 # - 192.168.1.0/24

View File

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

View File

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