HAProxy community

Calling an url if the active server is down


Is there any options to call an url (http) from ha-proxy config once it detects that the active server is down and before it starts serving backup servers? For example, I’m playing with the following config. My goal is to serve from LS1 as long as its running. Once LS1 is down, haproxy will start serving backup server LS2. I want it to call an url once LS1 is down.

    log     global
    mode    tcp
    option  tcplog
    option  dontlognull
    timeout connect 20s 
    timeout client  20s
    timeout server  20s
listen LS
    balance roundrobin
    option clitcpka
    option  tcplog
    option  dontlognull
    server LS1 check inter 2s fall 2 rise 99999999
    server LS2 check inter 2s backup

No, that is not possible out of the box. You probably need something external like parsing the syslog, but you cannot avoid that new connections hit the backup server before the that call is made.

Parsing logs seems not feasible to me to be a proper solution. Anyway, thanks @lukastribus for the information!

I think you could use a Lua task to perform such type of complicated checks :slight_smile: