From 0a4f78a153e3ac98ba2a4c6c5f2a531907a45d40 Mon Sep 17 00:00:00 2001 From: Joao M Date: Tue, 16 Aug 2022 20:34:32 +0000 Subject: [PATCH] Fix redirect loop --- templates/frontend-mode-http.j2 | 2 +- tests/expected/services-redirect-ssl.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/frontend-mode-http.j2 b/templates/frontend-mode-http.j2 index e6392ad..481f6ae 100644 --- a/templates/frontend-mode-http.j2 +++ b/templates/frontend-mode-http.j2 @@ -14,7 +14,7 @@ use_backend letsencrypt_backend if is_letsencrypt_{{ host }} is_rule_{{ host }}_1 OR is_letsencrypt_{{ host }} is_rule_{{ host }}_2 {% endif %} {% if o["hosts"][k]["redirect_ssl"] %} - http-request redirect scheme https code 301 if is_rule_{{ host }}_1 OR is_rule_{{ host }}_2 + http-request redirect scheme https code 301 if !is_letsencrypt_{{ host }} is_rule_{{ host }}_1 OR !is_letsencrypt_{{ host }} is_rule_{{ host }}_2 {% else %} use_backend srv_{{ host }} if is_rule_{{ host }}_1 OR is_rule_{{ host }}_2 {% endif %} diff --git a/tests/expected/services-redirect-ssl.txt b/tests/expected/services-redirect-ssl.txt index 9317251..3a3fb09 100644 --- a/tests/expected/services-redirect-ssl.txt +++ b/tests/expected/services-redirect-ssl.txt @@ -32,7 +32,7 @@ frontend http_in_80 acl is_rule_host1_local_80_1 hdr(host) -i host1.local acl is_rule_host1_local_80_2 hdr(host) -i host1.local:80 - http-request redirect scheme https code 301 if is_rule_host1_local_80_1 OR is_rule_host1_local_80_2 + http-request redirect scheme https code 301 if !is_letsencrypt_host1_local_80 is_rule_host1_local_80_1 OR !is_letsencrypt_host1_local_80 is_rule_host1_local_80_2 backend srv_host2_local_80 balance roundrobin