summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-04-21 12:51:35 +0200
committerGitHub <noreply@github.com>2024-04-21 12:51:35 +0200
commit6331040d560641921f44517298271e301ce52646 (patch)
tree4ffb08c661920b0a33f0f6c0cf8a6dea2b4a5602 /data
parent4cde677e9e128bc9b62fad720b1b6f6cac506954 (diff)
parent050f24770aec7a74c1a07ba64cf2cb83afb72f1a (diff)
downloadvyos-1x-6331040d560641921f44517298271e301ce52646.tar.gz
vyos-1x-6331040d560641921f44517298271e301ce52646.zip
Merge pull request #3338 from nvollmar/haproxy-http-check
T6246: improve haproxy http check configuration
Diffstat (limited to 'data')
-rw-r--r--data/templates/load-balancing/haproxy.cfg.j217
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'} %}