diff --git a/templates/haproxy_cfg b/templates/haproxy_cfg index 9d3f4687c4df5875163f10c44d0cb8e7974aae56..c4070e375eaa5dad18ee3d269b1f857c7133842c 100644 --- a/templates/haproxy_cfg +++ b/templates/haproxy_cfg @@ -60,7 +60,12 @@ frontend http_in http-request deny if blockedagent {% for host in groups['all'] %} {% for redirect in hostvars[host].proxy_redirect|default([]) %} - redirect prefix {{ redirect.protocol|default('https') }}://{{redirect.to}} code 301 if { hdr(host) -i -n {{redirect.from}} } +{% for from in redirect.from %} +{% for path in redirect.paths|default([]) %} + 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 %} } +{% endfor %} + redirect prefix {{ redirect.protocol|default('https') }}://{{redirect.to}} code 301 if { hdr(host) -i -n {{from}} } +{% endfor %} {% endfor %} {% if proxy_redirect_aliase %} {% for drupal in hostvars[host].drupal_settings|default([]) %} @@ -104,7 +109,12 @@ frontend https_in_{{ cert.ip }} http-request deny if blockedagent {% for host in groups['all'] %} {% for redirect in hostvars[host].proxy_redirect|default([]) %} - redirect prefix {{ redirect.protocol|default('https') }}://{{redirect.to}} code 301 if { hdr(host) -i -n {{redirect.from}} } +{% for from in redirect.from %} +{% for path in redirect.paths|default([]) %} + 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 %} } +{% endfor %} + redirect prefix {{ redirect.protocol|default('https') }}://{{redirect.to}} code 301 if { hdr(host) -i -n {{from}} } +{% endfor %} {% endfor %} {% if proxy_redirect_aliase %} {% for drupal in hostvars[host].drupal_settings|default([]) %}