By default an http(s) frontend with an unavailable backend replies with 500. You can also configure the frontend to immediately close the connection in this case.
But I did not find a possibility to disable the frontend in the same way as the ‘disable’ command on the stats console (and re-enable it after re-availability).
Is there a way to achieve this behavior, or do I have to write a feature request?
Why would someone have this? If you have a client (not a browser) that only supports the most simple health check (tcp-ping), that’s the behavior you need.
No, this is no supported, it also very rarely works because usually you’d bind to privileged ports and downgrade privileges after the initial bind, making it so that haproxy cannot rebind to the socket while running.
I’ve been trying alternatives, which were all not very satisfying. In my use case haproxy acts as forward and reverse proxy (service mesh). Taking down a listener is the easiest and most resource-conserving way to signal unavailability to the proxy counterpart. Especially when all proxies in the service mesh communicate via TLS with lots of heartbeats that all require extra handshakes.
In this scenario privileged ports are not used at all. haproxy in a service mesh is a more and more frequent use case. But this missing feature caused me a lot of headaches… Other ideas welcome
I suggest you file a detailed Feature request at: