Custom Server Error Messages

Linode Staff

Hello,

In the (hopefully rare) event of the failure of our Linode server, I'd like to serve a backup "Our service is down temporarily. We will be back soon" page to our site's visitors.

Is there any way I can use a Node Balancer (or some other Linode DNS solution) to detect failure in the primary Linode server and automatically route traffic to the static failure information page? I'd also like for the solution to re-detect primary-server-up state and switch traffic back to the primary server.

It would be great if we could do this with a Linode solution. If not, can you recommend / do you know of similar solutions your customers us to achieve this requirement?

Thanks in advanced for your help!

1 Reply

Hi there,

In most cases, these kinds of error responses are customized directly through your web server specifically for 4xx and 5xx responses. For Nginx, you'll essentially need to create a separate file for these error messages that Nginx will be directed to, and then create web pages that will be displayed in the event that you ever encounter these errors. From there, you'll need to adjust your server blocks to include your error page configuration, so that Nginx knows where and when to access them. Lastly, you just need to create some html pages that will be displayed instead of the default error messages. For a little more information regarding how you might do this, I'm including some documentation below which might help:

Nginx Help 1
Nginx Help 2
Nginx Help 3

For Apache the process will look similar, however this will require that you use the "ErrorDocument" directive from within your virtualhost files instead. Essentially, you add the directive to your configuration, select the error code the page will be displayed for, and then add the path for the file that will be displayed whenever you encounter an issue. For a little more information regarding how you might do this, I'm including some documentation below which might help:

Apache Help 1
Apache Help 2

If these error messages are dependent on a single host, they're less likely to be seen just because anything that would bring your server down entirely would prevent the message from being displayed. That being said, if you were to couple this with some high availability solutions, you should be able to both increase the uptime of your sites or services, and help to ensure that the error message you'd like to be displayed will be displayed. NodeBalancers are one way you could do this, but there are a few options you'd have for this, including something like a custom loadbalancer using HAProxy or a similar tool. In case you want to look into these solutions as well, I'm including a few more pieces of documentation below that should help you to get this set up:

High Availability 1
High Availability 2
High Availability 3

I hope that helps!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct