Allow to generate custom locations in load_balancer mode

This commit is contained in:
Alexander Rublev 2018-11-13 09:57:44 +03:00
parent 63126c3ff7
commit 33f72ee8f2
2 changed files with 9 additions and 3 deletions

View File

@ -168,6 +168,9 @@ nginx_http_template:
html_file_name: index.html
http_demo_conf: false
load_balancer:
locations:
backend:
location: /
proxy_pass: backend
health_check_plus: false
upstreams:

View File

@ -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 / {