Skip to main content

Display an error page when the server is experiencing heavy load or encounters an iIssue

info

Estimated Time: 5 minutes

Overview

This tutorial explains how to use KurocoEdge to display an error page when the server is experiencing heavy load or encounters issues.

Prerequisites

This tutorial assumes that you have already completed the steps outlined in the following Beginner's Guide:

What You'll Learn

You will learn how to configure KurocoEdge to display an error page when the server is experiencing heavy load or the website is unavailable by following these steps:

Create a Rule

lClick [KurocoEdge] > [Deployment list] from the side menu.
Image from Gyazo

Select an existing deployment.
Image from Gyazo

Click [Clone] in the top right corner.
Image from Gyazo

Set your site's URL, which you added in changing the display of your website tutorial, as the default backend.
Image from Gyazo

Click [Add] in the rule list page.
Image from Gyazo

Click the [Response] tab.
Image from Gyazo

Click [Add Action]. Image from Gyazo

Condition / Variable

Click [Add Field] in "Condition / Variable" and configure as follows:

FieldSettings
Field settingsHTTP Status
HTTP Response Code Pattern504
tip

The HTTP Status pattern is a Regex. So while 504 will of course work as intended, it is also possible to input 5.. (or 5.* to test for any 500-599 code, to allow creation of a single rule covering many errors at once.

Image from Gyazo

Execution

Click [Add Field] in "Execution" and configure as follows:

FieldSettings
Field settingsSynthetic Response
HTTP Status503 Service Unavailable
BodyEnter the content of the error page in HTML format.
In this tutorial, replace the default "sample" text wuth the following: <p>We apologize for the temporary error that occurred on the page you tried to access.</p><p>For more information, please contact example@test.com.</p>
HeaderNo changes needed

Image from Gyazo

tip

If you already have an error page prepated and want to redirect users to it, set up a Redirect URL field settings, select 302 Temporary Redirect, and enter the URL to redirect the users to.

Image from Gyazo

Verify the configuration

Once the rule is applied, the following page will be displayed.
The status code will also be set to 503 as configured.

Image from Gyazo

info

In the above screenshot, a similar rule for HTTP status 404 was set up to verify the configuration.

caution

KurocoEdge rules are only applied when the response from the backend server matches the configured condition (HTTP response code 504).
If KurocoEdge cannot connect to the backend server at all due to a server issues, the error page HTML configured in the Edge Settings will be displayed instead.

With this setup, when a 504 error occurs, the page specified in the "Execution" section will be displayed.


Support

If you have any other questions, please contact us or check out Our Discord Community.