diff options
author | Christian Breunig <christian@breunig.cc> | 2024-05-01 10:11:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-01 10:11:19 +0200 |
commit | c7d4126ab20da5414ce5ce811e8750dd1fe11b92 (patch) | |
tree | f81c0328accaa851162b594192f061e1e7e90526 /data | |
parent | 982221bb2649a7cef622d179f029f26bc3e1f3ed (diff) | |
parent | fbc33054f635e232f6deb60967b1f128a9b11dfe (diff) | |
download | vyos-1x-c7d4126ab20da5414ce5ce811e8750dd1fe11b92.tar.gz vyos-1x-c7d4126ab20da5414ce5ce811e8750dd1fe11b92.zip |
Merge pull request #3383 from vyos/mergify/bp/sagitta/pr-3382
haproxy: T6179: fix rule generation (backport #3382)
Diffstat (limited to 'data')
-rw-r--r-- | data/templates/load-balancing/haproxy.cfg.j2 | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/data/templates/load-balancing/haproxy.cfg.j2 b/data/templates/load-balancing/haproxy.cfg.j2 index e8622ba7b..7917c8257 100644 --- a/data/templates/load-balancing/haproxy.cfg.j2 +++ b/data/templates/load-balancing/haproxy.cfg.j2 @@ -85,7 +85,7 @@ frontend {{ front }} {% if front_config.rule is vyos_defined %} {% for rule, rule_config in front_config.rule.items() %} # rule {{ rule }} -{% if rule_config.domain_name is vyos_defined and rule_config.set.backend is vyos_defined %} +{% if rule_config.domain_name is vyos_defined %} {% set rule_options = 'hdr(host)' %} {% if rule_config.ssl is vyos_defined %} {% set ssl_rule_translate = {'req-ssl-sni': 'req_ssl_sni', 'ssl-fc-sni': 'ssl_fc_sni', 'ssl-fc-sni-end': 'ssl_fc_sni_end'} %} @@ -94,16 +94,20 @@ frontend {{ front }} {% for domain in rule_config.domain_name %} acl {{ rule }} {{ rule_options }} -i {{ domain }} {% endfor %} - use_backend {{ rule_config.set.backend }} if {{ rule }} {% endif %} {# path url #} -{% if rule_config.url_path is vyos_defined and rule_config.set.redirect_location is vyos_defined %} +{% if rule_config.url_path is vyos_defined %} {% set path_mod_translate = {'begin': '-i -m beg', 'end': '-i -m end', 'exact': ''} %} {% for path, path_config in rule_config.url_path.items() %} {% for url in path_config %} acl {{ rule }} path {{ path_mod_translate[path] }} {{ url }} {% endfor %} {% endfor %} +{% endif %} +{% if rule_config.set.backend is vyos_defined %} + use_backend {{ rule_config.set.backend }} if {{ rule }} +{% endif %} +{% if rule_config.set.redirect_location is vyos_defined %} http-request redirect location {{ rule_config.set.redirect_location }} code 301 if {{ rule }} {% endif %} {# endpath #} |