Report this

What is the reason for this report?

HAProxy change 503 page with a custom

Posted on February 21, 2015

Hello, im testing HAProxy to see what i can build with it. After shuting down all my nodes i noticed the ugly 503 page which tells me that there is no servers available. Is it possible to change this page? I cant find where its located



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I tried setting this up here is my configuration. frontend incoming-https default_backend bad_backend

backend bad_backend mode http errorfile 403 /etc/haproxy/errors/403.http

It redirects to 503 server not found. Not working as expected, please help…

In your HAProxy configuration, you can set a custom errorfile Checkout the HAProxy docs:

The files are returned verbatim on the TCP socket. This allows any trick such as redirections to another URL or site, as well as tricks to clean cookies, force enable or disable caching, etc… The package provides default error files returning the same contents as default errors.

The format is:

errorfile 503 /etc/haproxy/errorfiles/503sorry.http

And you’d want the file to be something like:

HTTP/1.0 503 Service Unavailable
Cache-Control: no-cache
Connection: close
Content-Type: text/html

<html> 
  <head>
    <title>403 -  Service Unavailable</title>
  </head> 
  <body>
    <div> 
          <h2 >Sorry. We're not here right now.</h2>
    </div>
  </body> 
</html>

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.