Redirect to external error or maintenance page for HA-Proxy?
-
How can I configure an external URL for a maintenance page in case the backend is not available?
Can I just put the redirect into the error file? -
@wgold said in Redirect to external error or maintenance page for HA-Proxy?:
How can I configure an external URL for a maintenance page in case the backend is not available?
Not absolutely sure, what you try to achieve here. If you want to display a simple web page on another host, in case the primary is down, you can set multiple hosts within a single backend.
State the primary as 'active' and the backup as 'backup'. So HAproxy will send the requests to the backup server if the health check for the primary is failing.Ensure that the health check succeed on both servers, when they are up.
-
Solved it. It's been more easy than I thought.
I created an Errorfile ("Files" section of HA-Proxy) with a redirect to an external "construction" page:
HTTP/1.0 302 Found
Cache-Control: no-cache
Location: https://constructionpage.example.com
Content-Type: text/html!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Moved Temporarily</title>
</head><body>
<h1>Moved </h1>
<p>The document has moved <a href="https://constructionpage.example.com">here</a>.</p>
</body></html>
.
.. and assigned that one with Error 503
I did not run the final test on the live system, but in a test environment it worked. -