Haproxy backend server error handling


#1

Hello Guys,

I am working on Haproxy to handle cases related to backend server up and down. I have handled some cases by reading documentation and some are still remaining. Please have a look below under heading “Remaining cases”. Please also review “Cases handled successfully” and Github gist and suggest if something is missing.

Cases handled successfully
1- Backend should be down in case of health check error and notify us via email
2- Backend should be up in case of health check pass and notify us via email
3- Serve maintenance page 503 in case when all servers are down.

Configuration of Haproxy for handling about cases are listed here(https://gist.github.com/junaid-malik-confiz/541a3afdc9b395501daf828e299c2daf)

Remaining cases
1- Backend should be mark down if it gives lot of 500s either consecutive or not. – This is not working.
2- Add authorization on the requests going for http checks, i tried solution mentioned here(https://stackoverflow.com/questions/13325882/haproxy-solr-healthcheck-with-authentication) and here(HAproxy health checks with authentication) but these didn’t work.

Thanks & Regards,
Junaid


#2

Haproxy cannot do this out of the box. I suggest you script this based on logs, intervening on the admin socket.

Use HTTP/1.0, not HTTP/1.1, double check credentials and make sure that your backend actually accepts the HEAD requests. If it still doesn’t work, your backend servers logfile will contain the reason it doesn’t work.