diff options
author | Nicolas Vollmar <nvollmar@gmail.com> | 2024-04-19 23:59:17 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2024-04-21 12:53:42 +0200 |
commit | 98a0fdbef343c20c5054abea478a81e5b86c254f (patch) | |
tree | 791414e77bccd814e505051fd2306d3deb8f35fc /data/templates | |
parent | 5a8310147b858ab85ed5a00fa6cb1f2e856f6a0c (diff) | |
download | vyos-1x-98a0fdbef343c20c5054abea478a81e5b86c254f.tar.gz vyos-1x-98a0fdbef343c20c5054abea478a81e5b86c254f.zip |
T6246: improve haproxy http check configuration
(cherry picked from commit 050f24770aec7a74c1a07ba64cf2cb83afb72f1a)
Diffstat (limited to 'data/templates')
-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'} %} |