diff --git a/defaults/main.yml b/defaults/main.yml index e558f81..ab13caa 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -168,7 +168,10 @@ nginx_http_template: html_file_name: index.html http_demo_conf: false load_balancer: - proxy_pass: backend + locations: + backend: + location: / + proxy_pass: backend health_check_plus: false upstreams: upstream1: diff --git a/templates/http/default.conf.j2 b/templates/http/default.conf.j2 index 827ad9f..9634427 100644 --- a/templates/http/default.conf.j2 +++ b/templates/http/default.conf.j2 @@ -24,8 +24,9 @@ server { {% endif %} server_name {{ item.value.server_name }}; {% if item.value.load_balancer is defined %} - location / { - proxy_pass http://{{ item.value.load_balancer.proxy_pass }}; +{% for location in item.value.load_balancer.locations %} + location {{ item.value.load_balancer.locations[location].location }} { + proxy_pass http://{{ item.value.load_balancer.locations[location].proxy_pass }}; {% if item.value.load_balancer.health_check_plus %} health_check; {% endif %} @@ -34,6 +35,8 @@ server { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } + +{% endfor %} {% endif %} {% if item.value.web_server is defined %} location / {