From 4e9df07d40a8f98393a2d2f24a31a56d7b5134c6 Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Mon, 8 Feb 2021 15:49:59 +0100 Subject: [PATCH] ansible-inventories/gentner#2370 Add support for redirects based global search and replace on the url --- templates/haproxy_cfg.jinja2 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/haproxy_cfg.jinja2 b/templates/haproxy_cfg.jinja2 index 227500c..7b2a66c 100644 --- a/templates/haproxy_cfg.jinja2 +++ b/templates/haproxy_cfg.jinja2 @@ -81,6 +81,9 @@ frontend http_in acl private_auth http_auth(notprivate) if !privateip http-request auth realm notprivate if !letsencrypt_challenge privatedomain !privateip !private_auth {% endif %} +{% for redirect in proxy_redirect_search_replace|default([]) %} + http-request redirect code 301 location %[url,regsub(\"{{ redirect.search }}\",\"{{ redirect.replace }}\",i)] if !letsencrypt_challenge { path_reg {{ redirect.search }} } +{% endfor %} {% for line in proxy_extra_lines|default([]) %} {{ line }} {% endfor %} @@ -217,6 +220,9 @@ frontend https_in_{{ cert.ip }} acl private_auth http_auth(notprivate) if !privateip http-request auth realm notprivate if privatedomain !privateip !private_auth {% endif %} +{% for redirect in proxy_redirect_search_replace|default([]) %} + http-request redirect code 301 location %[url,regsub(\"{{ redirect.search }}\",\"{{ redirect.replace }}\",i)] if { path_reg ^/{{ redirect.search }} } +{% endfor %} {% for line in proxy_extra_lines|default([]) %} {{ line }} {% endfor %} -- GitLab