Now when the first server is in "bad condition" (192.168.1.40:8443 is available, but the server does not respond), Apache waits 10 s and than it sends 502 error to client, instead of using the second server. What is wrong? Thanks in advance.
timeout is making it wait 10 seconds to see if server responds in that time because it is taking long to answer but has accepted the connection, if you want to make it wait less, adjust it.
AFAIK, httpd does not send the request to the other balancer member until the first has failed, so at least you will get one failure for 30 seconds and a wait of 10 every time httpd retries a backend that is failing.
Someone may correct me though, but I haven't managed with your setup, perhaps reaching this point you can try with mod_proxy_hcheck. Although timeouts are tricky.
-- Daniel Ferradal
HTTPD Project
#httpd help at Libera.Chat