Date created: Friday, May 3, 2013 3:30:34 PM. Last modified: Friday, May 3, 2013 3:30:34 PM

Monitor URI with Backend ACL

Here the frontend ACL backend_down will be true if less than two backend servers are considered "UP" by HAProxy. 

Accessing the monitor URI from a host outside the monitor-net subnet will return HTTP 200 OK. When the ACL evaluates to true (when less than 2 back end servers are up) the monitor fail action will take over, and a HTTP 503 error will be returned. For the host that is inside the monitor-net subnet, they will always receive the HTTP 200 OK response, simply to indicate that HAProxy is running, irelivant of the backend status.

In the docs, "In HTTP mode, a connection coming from a source matching <source> will be accepted, the following response will be sent without waiting for a request, then the connection will be closed : "HTTP/1.0 200 OK". This is normally enough for any front-end HTTP probe to detect that the service is UP and running without forwarding the request to a backend server.


frontend monitor-http-servers

        acl backend_down nbsrv(http-servers) lt 2

        monitor-uri /mymonitoruri
        monitor fail if backend_down

	default_backend http-iis-servers

backend http-servers

        cookie server insert
        option persist
        option redispatch
        server  server1 cookie s1 check inter 2000 rise 3 fall 3
        server  server2 cookie s2 check inter 2000 rise 3 fall 3

Previous page: HAProxy
Next page: keepalived