From 9f087306e7237474955a91cea224b4c0e5220905 Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Sat, 6 Oct 2018 22:23:41 -0500 Subject: [PATCH] Fix Redirect --- entrypoint.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/entrypoint.py b/entrypoint.py index 8edd1ce..6569db9 100644 --- a/entrypoint.py +++ b/entrypoint.py @@ -43,7 +43,7 @@ frontend stats stats realm Haproxy\ Statistics stats uri / stats auth {0}:{1} -# acl is_proxystats hdr_dom(host) -i some.host.com +# acl is_proxystats hdr(host) -i some.host.com # default_backend srv_stats # use_backend srv_stats if is_proxystats default_backend srv_stats @@ -67,23 +67,14 @@ frontend http_in_{0} """.format(port) for k in redir: - host = k.replace(".", "_") + "_{}".format(port) - result += " acl is_redir_{0} hdr_dom(host) -i {1}\n".format(host, k) - result += " use_backend redir_{0} if is_redir_{0}\n\n".format(host) + result += " redirect prefix " + redir[k] + " code 301 if { hdr(host) -i " + k + " }\n" + result += "\n" for k in hosts: host = k.replace(".", "_") + "_{}".format(port) - result += " acl is_rule_{0} hdr_dom(host) -i {1}\n".format(host, k) + result += " acl is_rule_{0} hdr(host) -i {1}\n".format(host, k) result += " use_backend srv_{0} if is_rule_{0}\n\n".format(host) - for k in redir: - host = k.replace(".", "_") + "_{}".format(port) - result += """ -backend redir_{0} - mode http - redirect location {1} code 302 -""".format(host, redir[k]) - for k in hosts: host = k.replace(".", "_") + "_{}".format(port) result += """