From dd5a6dd8b615021ae7b79e3a7be4ff774a032f7f Mon Sep 17 00:00:00 2001 From: Bart Geesink Date: Tue, 28 May 2024 10:41:55 +0200 Subject: [PATCH] Haproxy: Redirect rule now uses base so you can redirect a URL +path --- roles/haproxy/templates/haproxy_frontend.cfg.j2 | 2 +- roles/haproxy/templates/validvhostsunrestricted.acl.j2 | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/haproxy/templates/haproxy_frontend.cfg.j2 b/roles/haproxy/templates/haproxy_frontend.cfg.j2 index cab98665a..1857784c1 100644 --- a/roles/haproxy/templates/haproxy_frontend.cfg.j2 +++ b/roles/haproxy/templates/haproxy_frontend.cfg.j2 @@ -103,7 +103,7 @@ frontend local_ip acl securitytxt path /.well-known/security.txt http-request redirect location {{ haproxy_securitytxt_target_url }} if securitytxt {% endif %} - http-request redirect location %[req.hdr(host),lower,map(/etc/haproxy/maps/redirects.map)] if { req.hdr(host),lower,map_str(/etc/haproxy/maps/redirects.map) -m found } + http-request redirect location %[base,map_reg(/etc/haproxy/maps/redirects.map)] if { base,map_reg(/etc/haproxy/maps/redirects.map) -m found } {% if haproxy_sni_ip_restricted is defined %} #-------------------------------------------------------------------- diff --git a/roles/haproxy/templates/validvhostsunrestricted.acl.j2 b/roles/haproxy/templates/validvhostsunrestricted.acl.j2 index 220991634..52ea259f5 100644 --- a/roles/haproxy/templates/validvhostsunrestricted.acl.j2 +++ b/roles/haproxy/templates/validvhostsunrestricted.acl.j2 @@ -5,6 +5,8 @@ {% endfor %} {%if haproxy_redirects is defined %} {% for application in haproxy_redirects %} -{{ application.url }} +{%if application.hostname is defined %} +{{ application.hostname }} +{% endif %} {% endfor %} {% endif %}