Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Redirect to external error or maintenance page for HA-Proxy?

    Scheduled Pinned Locked Moved Cache/Proxy
    3 Posts 2 Posters 554 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      wgold
      last edited by

      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?

      V 1 Reply Last reply Reply Quote 0
      • V
        viragomann @wgold
        last edited by

        @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.

        1 Reply Last reply Reply Quote 0
        • W
          wgold
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • V viragomann referenced this topic on
          • First post
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.