All Products
Search
Document Center

Edge Security Acceleration:Configure a custom error page

Last Updated:Mar 20, 2025

By default, pages with an Edge Security Acceleration (ESA) identifier and the 403 error code are returned for requests that are blocked by ESA. If you want to use a personalized page with a business identifier, you can create a custom error page.

Before you begin

  • You can create up to 10 custom error pages for each Alibaba Cloud account.

  • Each custom error page cannot exceed 2 KB in size. Only custom error pages in HTML and JSON formats are supported.

Reference rules

When you create a rule, set the Action parameter in the Then execute... section to Block. Then, you can reference the custom error page in the Error Page field.

You can reference the following rules:

Error pages triggered by WAF rules, whether default or custom, are excluded from your traffic quota and do not affect your billing.

Create a custom error page

  1. Log on to the ESA console, and in the left-side navigation pane, choose Global Settings > Custom Pages.

  2. On the Custom Pages page, click Create Custom Page, specify the Page Name, Page Type, and Source Code parameters:

    • Page Name

    The name of the error page. The name must be 1 to 30 characters in length and can contain letters, digits, and hyphens (-).

    • Description

    The description can be up to 100 characters in length.

    • Page Type

      The page type. Valid values:

      • text/html

      • application/json

    • Source Code

      The source code of the error page. The code cannot exceed 2 KB in size. You can use the {{REQUEST_ID}} and {{RULE_ID}}parameters to indicate the ID of the blocked request and the ID of the rule that triggers blocking in the code. This helps collect user feedback and identify issues.

  3. Click OK.

Reference a custom error page

After you create a custom page, you can reference the page when you configure the custom rules.

  1. In the ESA console, choose Websites and click the website name you want to manage.

  2. In the left-side navigation pane, choose Security > WAF > Custom Rules > Create Rule. On the Create Custom Rule page, specify Rule Name.

  3. In the If requests match... section, set the match field to Client IP, set the logical operator to is in and specify the match value.

  4. In the Then execute... section, set Action to Block, set Error Page to the custom error page that you created, set the status code to 400, and then click OK.

Verify the configuration

After you complete the configuration of the custom error page in WAF, access the accelerated domain name and verify that the predefined 400 status code is returned. The following screenshot shows the domain name resolution takes effect and the protection rule is enabled.

image