summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-04-21 12:54:13 +0200
committerGitHub <noreply@github.com>2024-04-21 12:54:13 +0200
commit2208c846d6bffeecac99afa7ebc3eda5c467aebc (patch)
tree984e88cdf2604bb418608fd8b2970c4f3739c710 /data
parent8062edbefb311257c5f0dd5e6810334e4d120eb9 (diff)
parent98a0fdbef343c20c5054abea478a81e5b86c254f (diff)
downloadvyos-1x-2208c846d6bffeecac99afa7ebc3eda5c467aebc.tar.gz
vyos-1x-2208c846d6bffeecac99afa7ebc3eda5c467aebc.zip
Merge pull request #3332 from vyos/mergify/bp/sagitta/pr-3325
T6246: basic haproxy http-check configuration (backport #3325)
Diffstat (limited to 'data')
-rw-r--r--data/templates/load-balancing/haproxy.cfg.j220
1 files changed, 20 insertions, 0 deletions
diff --git a/data/templates/load-balancing/haproxy.cfg.j2 b/data/templates/load-balancing/haproxy.cfg.j2
index feb10d247..dd93afba5 100644
--- a/data/templates/load-balancing/haproxy.cfg.j2
+++ b/data/templates/load-balancing/haproxy.cfg.j2
@@ -110,6 +110,26 @@ frontend {{ front }}
{% if backend is vyos_defined %}
{% for back, back_config in backend.items() %}
backend {{ back }}
+{% if back_config.http_check is vyos_defined %}
+ option httpchk
+{% endif %}
+{% 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 %}
+{% 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'} %}
balance {{ balance_translate[back_config.balance] }}