HAProxy community

Checking files for Health Check on multiple servers


Currently I’m using HAProxy to route traffic through four different servers that offer the same service but are located on different physical boxes. I’m wanting to setup a healthcheck that goes against each individual server with the goal of stopping traffic getting routed when it fails to find a file. Everything that I have read online only shows that you can the check against one server though, for example:

option httpchk GET http://service.com/healthcheck

server server1.service.com
server server2.service.com

Is there a way to have the httpchk to do this?

option httpchk GET http://server1.com/healthcheck

server server1.service.com

option httpchk GET http://server2.com/healthcheck

server server2.service.com

Dynamically update host for http health check

If you want to check the same page the code will be like that:

backend name_backend
 	option httpchk GET /healthcheck HTTP/1.0
	mode http
    	server server1.service.com  check fall 2 inter 1000 rise 3
    	server server2.service.com check fall 2 inter 1000 rise 3

Dont forget that backend should be in http mode to perform this.