Skip to content

Commit 7785bab

Browse files
scodemanalessfg
authored andcommitted
Add support for multiple rewrite directives as per nginx conf (#176)
1 parent 41aeda3 commit 7785bab

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,8 @@ nginx_http_template:
490490
#always: false
491491
proxy_connect_timeout: null
492492
proxy_pass: http://backend
493-
#rewrite: /foo(.*) /$1 break
493+
#rewrites:
494+
# - /foo(.*) /$1 break
494495
#proxy_pass_request_body: off
495496
#allows:
496497
# - 192.168.1.0/24

defaults/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ nginx_http_template:
304304
#always: false
305305
proxy_connect_timeout: null
306306
proxy_pass: http://backend
307-
#rewrite: /foo(.*) /$1 break
307+
#rewrites:
308+
# - /foo(.*) /$1 break
308309
#proxy_pass_request_body: off
309310
#allows:
310311
# - 192.168.1.0/24

templates/http/default.conf.j2

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,10 @@ server {
196196
proxy_connect_timeout {{ item.value.reverse_proxy.locations[location].proxy_connect_timeout }};
197197
{% endif %}
198198
proxy_pass {{ item.value.reverse_proxy.locations[location].proxy_pass }};
199-
{% if item.value.reverse_proxy.locations[location].rewrite is defined %}
200-
rewrite {{ item.value.reverse_proxy.locations[location].rewrite }};
199+
{% if item.value.reverse_proxy.locations[location].rewrites is defined %}
200+
{% for rewrite in item.value.reverse_proxy.locations[location].rewrites %}
201+
rewrite {{ rewrite }};
202+
{% endfor %}
201203
{% endif %}
202204
{% if item.value.reverse_proxy.locations[location].proxy_read_timeout is defined and item.value.reverse_proxy.locations[location].proxy_read_timeout %}
203205
proxy_read_timeout {{ item.value.reverse_proxy.locations[location].proxy_read_timeout }};

0 commit comments

Comments
 (0)