Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

haproxy return empty response

I'd like to have health checks to an haproxy instance fail solely based on whether haproxy is running. In other words I don't want the health check to be proxied to a backend server.

I see there is a way to do this by returning a static file. This would work for me, but I was wondering: Is there a way to return an empty response with just a status code without having to return a file and deal with the false 503? The solution linked seems hacky and I worry that behavior will not be allowed in some later version.

like image 963
lf215 Avatar asked Apr 08 '26 11:04

lf215


1 Answers

monitor-uri <uri>

Intercept a URI used by external components' monitor requests
May be used in sections :

When an HTTP request referencing will be received on a frontend, HAProxy will not forward it nor log it, but instead will return either "HTTP/1.0 200 OK" or "HTTP/1.0 503 Service unavailable", depending on failure conditions defined with "monitor fail". 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. Note that the HTTP method, the version and all headers are ignored, but the request must at least be valid at the HTTP level. This keyword may only be used with an HTTP-mode frontend.

Example :

# Use /haproxy_test to report haproxy's status
frontend www
    mode http
    monitor-uri /haproxy_test
like image 128
nuster cache server Avatar answered Apr 17 '26 03:04

nuster cache server



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!