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

    HAProxy Maint Mode Page

    Scheduled Pinned Locked Moved pfSense Packages
    4 Posts 2 Posters 1.3k 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.
    • B
      Brailyn
      last edited by Brailyn

      Using the HAProxy dashboard widget to put servers into maintenance mode.

      When doing so, browsers show a "This site can't be reached".

      If I remember correctly, this used to show 503 error and something about maintenance mode.

      I see in Services/HAProxy/Files an ExampleErrorFile which looks to be what I am after... How do I enable this?

      Name: ExampleErrorFile
      Type: Errorfile
      content:

      HTTP/1.0 503 Service Unavailable
      Cache-Control: no-cache
      Connection: close
      Content-Type: text/html
      
      <html> 
        <head>
          <title>Sorry the webserver you are trying to contact is currently not available.</title>
        </head> 
        <body style="font-family:Arial,Helvetica,sans-serif;">
          <div style="margin: 0 auto; width: 960px;"> 
                <h2>Sorry the webserver you are trying to contact is currently not available.</h2>
          </div>
      The error returned is [<i>{errorcode} {errormsg}</i>] please try again later.
        </body> 
      </html>
      
      P 1 Reply Last reply Reply Quote 0
      • P
        PiBa @Brailyn
        last edited by PiBa

        @brailyn
        Configure the 'error file' in the frontend or backend where you want it to show up. And make sure its using mode http. Haproxy does not return the error file in a tcp frontend.

        1 Reply Last reply Reply Quote 0
        • B
          Brailyn
          last edited by

          Frontend is type ssl/https... When I set error code to 503 and the Error Page to the example, nothing happens.

          Also tried the same thing on one of the backends and same issue. Any ideas what I might be missing?

          P 1 Reply Last reply Reply Quote 0
          • P
            PiBa @Brailyn
            last edited by

            @brailyn
            Well.. ssl/https uses 'mode tcp'. And haproxy will not send the errorfile in that case.
            To make haproxy respond with a http error response, you would need it to 'offload' the ssl traffic with a certificate. Or if you can supply haproxy with the certificate you could still pass the main traffic as-is with the sni frontend and send it to a second 'local frontend' that does the decryption of the https request if a backend is down to serve the error reply.. Together with a nbsrv acl to switch to that second 'error frontend' if the webserver is down.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.