HAProxy switch only in case of server down

Check out this config:

listen my-server 0.0.0.0:80
    balance roundrobin
    server web01 10.10.10.1:80 check inter 10s fall 3 rise 99999999
    server web02 10.10.10.2:80 check backup

All requests will hit web01 by default. web02 will not be used. If web01 stops responding, after 30s (3 checks at 10 seconds intervals) the server will be taken offline. web02 will be brought online and all requests will hit it.

If web01 recovers, it will only be brought back online once 99999999 checks at an interval of 10 seconds pass – which is effectively never.

Leave a Comment