HAProxy nbsrv seems to give wrong value
I'm not entirely sure if the following will work for you, and can't test right now, but maybe it's helpful, still:
HAProxy config of dc01
:
defaults
mode http
frontend front_www
listen 0.0.0.0:80
acl acl_backend_down nbsrv(back_www) lt 1
monitor-uri /health
monitor fail if acl_backend_down
use_backend dc02 if acl_backend_down
default_backend back_www
backend back_wwww
server s1 1.2.3.1:80 check
server s2 1.2.3.2:80 check
backend dc02
server haproxy-dc2 1.3.4.1:80 check
Leverage the monitor-uri and monitor fail directives and check /health
from dc02
(and vice versa). /health
should report HTTP 200
if at least one backend is alive and healthy, otherwise HTTP 503
.