Quintin Par
Quintin Par

Reputation: 16252

Haproxy: send custom http response when maxconn is hit

Is it possible to send a custom http response back from Haproxy if the load balancer hits maxconn?

My intention is to send a busy tone equivalent (but not 503) if the server is busy.

Upvotes: 1

Views: 6164

Answers (1)

ty.
ty.

Reputation: 11132

The errorfile keyword may be used in your configuration for this:

errorfile 503 /etc/haproxy/errors/503.http

Where 503.http is something like:

HTTP/1.0 503 Service Unavailable^                                                                                      Cache-Control: no-cache
Connection: close
Content-Type: text/html

<html><body><h1>503 Service Unavailable</h1>
Sorry, no server is available to handle this request.
</body></html>

Upvotes: 2

Related Questions