hello @Liso ,
I think you need to create two backends , one with the four servers ( A-D ) and one with only server X inside the backend blocks like so:
backend fourofthem
mode http
balance roundrobin
server A ip-for-A check
server B ip-for-B check
server C ip-for-C check
server D ip-for-D check
backend justx
mode http
balance roundrobin
server X ip-for-X check
Now , in your frontend you may specify an acl that checks for the number of servers in backend “fourofthem” and redirect your traffic to backend “justx” if the number of servers is less than four
and justx is alive.
The frontend could look like this:
frontend thefrontend
listen....
acl atleastonedown nbsrv(fourofthem) lt 4
acl x_is_still_alive nbsrv(justx) ge 1
use_backend justx if atleastonedown x_is_still_alive
default_backend fourofthem
As soon as the one backend of “fourofthem” goes down the first acl will return true and if justx is alive as well , it will get the traffic. Otherwise all traffic will end in your default backend “fourofthem”.
For reference nbsrv() receives a string input argument, which is the backend name and returns the number of alive servers in that backend.
I hope this solves your problem