HAProxy community

HAproxy custom healthcheck


I have an HAProxy as a member in A10 and whenever A10 sends “/healthcheck” call- HAProxy needs to return “ACTIVE” word. I was trying-

backend xxx.healthcheck
mode http
timeout server 60s
default-server inter 5s fall 3 rise 2
http-check expect string “ACTIVE”

            errorfile 503 /var/prod/xxx-shared/scripts/HAProxy/hk.http

but definitely I’m doing something wrong- as my tests are showing

503 Service Unavailable
No server is available to handle this request.

instead of ACTIVE word in the response.

contents of hk.http:

HTTP/1.1 200 OK\r\n
Server: Apache-Coyote/1.1\r\n
Content-Type: text/html;charset=UTF-8\r\n

<?xml version="1.0" encoding="UTF-8"?> ACTIVE


Please share the entire configuration and logs. Most likely you are not properly routing towards the healthcheck backend.

http-check expect string “ACTIVE” is useless. This is for healthchecking haproxy backends, not to return a specific content when another load-balancing layer is healthchecking haproxy.

Another question: do you need to return ACTIVE or do you need to return XML as per your hk.http file?


You are right- I was sending to wrong backend. here is my config, which is working and we can close this thread.

acl acl_healthcheck path_end -i /HealthCheck
use_backend xxx.healthcheck if acl_healthcheck

backend xxx.healthcheck
mode http
errorfile 503 /var/prod/xxx-shared/scripts/HAProxy/healthcheck/hk.http

cat /var/prod/xxx-shared/scripts/HAProxy/healthcheck/hk.http

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/plain;charset=UTF-8
Cache-Control: no-cache
Connection: close


Note: I didn’t put any CRLF in the error file as mentioned in lot of posts in internet.