We're using haproxy's custom error page feature to show a "fail whale" maintenance page while we're doing deployments to our site.
However, since haproxy cannot show SSL'd users the custom error page, how can I redirect users to a non-SSL'd connection, to show the "fail whale" if there are no backends available?
As I understand it, you can't redirect clients from within haproxy since it can't interact with SSL connections at all (can't decrypt the request or encrypt the response with the redirection). The connection has to go to some server with SSL support in order to do this.
The only thing I can think of is to set up another webserver with the SSL key/cert and the fail whale page (could even be running on some odd port on the haproxy machine itself, use
localhost:4433
or something like that), and have haproxy send all the SSL connections to that server during maintenance.I ended up installing stunnel on the load balancer, and redirecting traffic back onto port 80 thru the tunnel.
HTTPs client => haproxy:443 => (no backends available, use 'backup' server 127.0.0.1:4443) => 127.0.0.1:443 (stunnel) => 127.0.0.1:80 (haproxy, with failwhale page)
haproxy.conf
stunnel.conf
The only way HAProxy can do this is if it is also terminating the SSL connections. In this setup the HAProxy server(s) would have the SSL certificates and it would communicate with the server pool via further SSL (a new connection) or straight up HTTP.
Another option is to have a SSL-enabled webserver just for fail-whale serving that'll serve up the same fail-whale page no matter what URI it is passed. That way, you can keep that one server as the 'backup' server and any attempts to connect will get whale-goodness.