diff --git a/templates/haproxy_cfg b/templates/haproxy_cfg index cb582444013b46c10b06144719f21ce86f54e592..747e2b2d98cbd5c456dc48d13ac6ee81bbdc6095 100644 --- a/templates/haproxy_cfg +++ b/templates/haproxy_cfg @@ -68,7 +68,16 @@ frontend http_in {% for path in redirect.paths|default([]) %} {% if path.deny|default(false) %} http-request deny if { hdr(host) -i -n {{from}}{% if path.from is defined %} } { path_beg /{{path.from}}{% endif %} } -{% else %} +{% endif %} +{% endfor %} +{% endfor %} +{% endfor %} +{% endfor %} +{% for host in groups['all'] %} +{% for redirect in hostvars[host].proxy_redirect|default([]) %} +{% for from in redirect.from %} +{% for path in redirect.paths|default([]) %} +{% if not path.deny|default(false) %} redirect location {{ redirect.protocol|default('https') }}://{{redirect.to}}/{{path.to|default('')}} code 301 if { hdr(host) -i -n {{from}}{% if path.from is defined %} } { path_beg /{{path.from}}{% endif %} } {% endif %} {% endfor %} @@ -135,7 +144,16 @@ frontend https_in_{{ cert.ip }} {% for path in redirect.paths|default([]) %} {% if path.deny|default(false) %} http-request deny if { hdr(host) -i -n {{from}}{% if path.from is defined %} } { path_beg /{{path.from}}{% endif %} } -{% else %} +{% endif %} +{% endfor %} +{% endfor %} +{% endfor %} +{% endfor %} +{% for host in groups['all'] %} +{% for redirect in hostvars[host].proxy_redirect|default([]) %} +{% for from in redirect.from %} +{% for path in redirect.paths|default([]) %} +{% if not path.deny|default(false) %} redirect location {{ redirect.protocol|default('https') }}://{{redirect.to}}/{{path.to|default('')}} code 301 if { hdr(host) -i -n {{from}}{% if path.from is defined %} } { path_beg /{{path.from}}{% endif %} } {% endif %} {% endfor %}