diff options
author | Nicolas Vollmar <nvollmar@gmail.com> | 2024-04-19 23:59:17 +0200 |
---|---|---|
committer | Nicolas Vollmar <nvollmar@gmail.com> | 2024-04-21 10:33:41 +0200 |
commit | 050f24770aec7a74c1a07ba64cf2cb83afb72f1a (patch) | |
tree | 6705d3907cf5d717b492c2350c71104ae8f79d51 /data/templates/load-balancing | |
parent | 89b56ef6da19ccff2df508e4e4a04d4feff0e04e (diff) | |
download | vyos-1x-050f24770aec7a74c1a07ba64cf2cb83afb72f1a.tar.gz vyos-1x-050f24770aec7a74c1a07ba64cf2cb83afb72f1a.zip |
T6246: improve haproxy http check configuration
Diffstat (limited to 'data/templates/load-balancing')
-rw-r--r-- | data/templates/load-balancing/haproxy.cfg.j2 | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/data/templates/load-balancing/haproxy.cfg.j2 b/data/templates/load-balancing/haproxy.cfg.j2 index 83008e50a..dd93afba5 100644 --- a/data/templates/load-balancing/haproxy.cfg.j2 +++ b/data/templates/load-balancing/haproxy.cfg.j2 @@ -113,11 +113,22 @@ backend {{ back }} {% if back_config.http_check is vyos_defined %} option httpchk {% endif %} -{% if back_config.http_check.uri is vyos_defined and back_config.http_check.method is vyos_defined %} - http-check send meth {{ back_config.http_check.method | upper }} uri {{ back_config.http_check.uri }} +{% set send = '' %} +{% if back_config.http_check.method is vyos_defined %} +{% set send = send + ' meth ' + back_config.http_check.method | upper %} +{% endif %} +{% if back_config.http_check.uri is vyos_defined %} +{% set send = send + ' uri ' + back_config.http_check.uri %} +{% endif %} +{% if send != '' %} + http-check send{{ send }} {% endif %} {% if back_config.http_check.expect is vyos_defined %} - http-check expect {{ back_config.http_check.expect }} +{% if back_config.http_check.expect.status is vyos_defined %} + http-check expect status {{ back_config.http_check.expect.status }} +{% elif back_config.http_check.expect.string is vyos_defined %} + http-check expect string {{ back_config.http_check.expect.string }} +{% endif %} {% endif %} {% if back_config.balance is vyos_defined %} {% set balance_translate = {'least-connection': 'leastconn', 'round-robin': 'roundrobin', 'source-address': 'source'} %} |