From be3ddab78662b07ef65a1828618004c2290ae01b Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Mon, 13 Mar 2017 11:36:35 +0100 Subject: [PATCH] Redirect prefix only if no wildcard domain --- templates/haproxy_cfg.jinja2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/haproxy_cfg.jinja2 b/templates/haproxy_cfg.jinja2 index 49d746a..12c16e7 100644 --- a/templates/haproxy_cfg.jinja2 +++ b/templates/haproxy_cfg.jinja2 @@ -88,8 +88,8 @@ frontend http_in {% endif %} {% endif %} {% endfor %} -{% if from != redirect.to or redirect.protocol|default('https') == 'https' %} - redirect prefix {{ redirect.protocol|default('https') }}://{{redirect.to}} code 301 if { {{ (from == ".") | ternary('hdr_sub', 'hdr') }}(host) -i -n {{ from }} } +{% if (from != redirect.to or redirect.protocol|default('https') == 'https') and from != "." %} + redirect prefix {{ redirect.protocol|default('https') }}://{{redirect.to}} code 301 if { hdr(host) -i -n {{ from }} } {% endif %} {% endfor %} {% endfor %} @@ -198,8 +198,8 @@ frontend https_in_{{ cert.ip }} {% endif %} {% endif %} {% endfor %} -{% if from != redirect.to or redirect.protocol|default('https') != 'https' %} - redirect prefix {{ redirect.protocol|default('https') }}://{{redirect.to}} code 301 if { {{ (from == ".") | ternary('hdr_sub', 'hdr') }}(host) -i -n {{ from }} } +{% if (from != redirect.to or redirect.protocol|default('https') != 'https') and from != "." %} + redirect prefix {{ redirect.protocol|default('https') }}://{{redirect.to}} code 301 if { hdr(host) -i -n {{ from }} } {% endif %} {% endfor %} {% endfor %} -- GitLab