diff --git a/README.md b/README.md index 4da9786..5ab3e5d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/defaults/main.yml b/defaults/main.yml index 167cd95..3570d68 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/templates/http/default.conf.j2 b/templates/http/default.conf.j2 index 4e3855c..80681f1 100644 --- a/templates/http/default.conf.j2 +++ b/templates/http/default.conf.j2 @@ -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 }};