Checking files for Health Check on multiple servers


#1

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 192.168.0.101:80
server server2.service.com 192.168.0.102:80

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

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

server server1.service.com 192.168.0.101:80

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

server server2.service.com 192.168.0.101:80


Dynamically update host for http health check
#2

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  192.168.0.101:80  check fall 2 inter 1000 rise 3
    	server server2.service.com  192.168.0.102:80 check fall 2 inter 1000 rise 3

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