Skip to content

Commit dbf1700

Browse files
committed
add healthcheck when basic auth is configured
1 parent 46eb061 commit dbf1700

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ansible/roles/haproxy/templates/haproxy.cfg.j2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ listen prometheus
3737
{% if enable_alertmanager | bool %}
3838
listen alertmanager
3939
bind {{ ansitheus_vip_address }}:{{ alertmanager_port }}
40+
option httpchk GET /-/ready
41+
{% if alertmanager_web_config is defined and alertmanager_web_config.basic_auth_users | length > 0 %}
42+
http-check expect status 401
43+
{% else %}
44+
http-check expect status 200
45+
{% endif %}
4046
http-request del-header X-Forwarded-Proto
4147
http-request set-header X-Forwarded-Proto https if { ssl_fc }
4248
{% for host in groups['alertmanager'] %}

0 commit comments

Comments
 (0)