Updated on 2026-10-10 GMT+08:00

Modifying the Alarm Page

The alarm page is the page that WAF returns when a request is blocked. WAF supports three types of pages: default, custom, and redirection. You can choose one based on your service requirements. The configuration takes effect immediately and does not affect the service forwarding efficiency.

Table 1 Alarm page returned after WAF blocking a request

Configuration Type

Description

Application Scenario

Advantage

Default

WAF returns the default page when it blocks a request.

The default HTTP return code is 418. This status code is a common WAF identifier in the industry. It helps O&M personnel quickly identify WAF blocking actions and avoid confusion with other response error codes such as 404 or 500.

This mode is applicable to most scenarios without special requirements.

Zero configuration, no need for technical expertise

Custom

You can configure a custom return code, response header, page type, and page content for the alarm page based on your service needs.

Requirements for displaying the brand logo and personalized error messages

Flexible adaptation to service styles

Redirection

You can configure the normal page to which users are redirected. The root domain name must be the same as the protected domain name, or the redirection will fail.

Website users are redirected to a normal page. For example, if a 404 error occurs, users are redirected to the website home page.

Reduce the user churn rate.

Constraints

  • Access mode restrictions: Cloud mode load balancer access: The Redirection template is not supported.
  • The content of the text/html, text/xml, and application/json pages can be configured on the Custom block page to be returned.
  • The root domain name of the redirection address must be the same as the currently protected domain name (including a wildcard domain name). For example, if the protected domain name is www.example.com and the port is 8080, the redirection URL can be set to http://www.example.com:8080/error.html.

Editing Response Page for Blocked Requests

  1. Log in to the WAF console.
  2. Click in the upper left corner and select a region or project.
  3. (Optional) If you have enabled the enterprise project function, in the upper part of the navigation pane on the left, select your enterprise project from the Filter by enterprise project drop-down list. Then, WAF will display the related security data in the enterprise project on the page.
  4. In the navigation pane on the left, choose Assets > Protected Objects.
  5. On the Protected Objects page, click the target domain name.
  6. In the Advanced Settings area, click Edit next to the Alarm Page template name. In the displayed Alarm Page dialog box, configure the page based on the selected Page Template.

    Table 2 Returned page configuration description

    Page Template

    Configuration Description

    Implementation Effect

    Default

    If you select Default for Page Template, the default alarm page is returned to visitors.

    The page where HTTP status code is 418 is returned, as shown in Figure 1

    Custom

    1. Select Custom for Page Template to customize a block page.
    2. Complete the page configuration:
      • HTTP Return Code: Specify a return code for the custom page. For example, you can enter 403 (access denied, such as SQL injection interception), 418 (WAF block identifier), or 503 (temporarily unavailable, such as CC attack block).
      • Response Header: Click Add Response Header Field and configure response header parameters. For example, you can add the X-WAF-Intercept: true header to quickly filter requests blocked by WAF during log analysis.
      • Block Page Type: Select the type of the returned page. The options are text/html, text/xml, and application/json.
      • Page Content: Configure the page content based on what you select for Block Page Type.
        Configuration examples:
        • text/html configuration example (brand identifier can be carried):
          <!DOCTYPE html> 
          <html> 
          <head><meta charset="UTF-8"><title>Access Restricted</title></head>
          <body style="text-align:center;margin-top:100px;"> 
            <img src="https://your-brand-logo-XXX-XXXX.png" alt="Brand LOGO"><br>   //Replace the built-in variables of the brand logo address and brand name for quick fault locating.
            <h1>Sorry, your access is blocked due to security risks.</h1>
          <p>If you are an authorized user, contact customer service at 400-xxx-xxxx.</p>;
          </body> 
          </html>
        • application/json configuration example (adapted to API services):
          1
          2
          3
          4
          5
          { 
            "code": 403, 
            "message": "The request contains security risks and has been blocked by Huawei Cloud WAF.",
            "requestId": "${requestId}" // Built-in variable, which is used to locate faults.
          }
          
    • Figure 2 shows the alarm page for the text/html type.
    • Figure 3 shows the alarm page for the application/json type.

    Redirection

    1. Select Redirection for Page Template.
    2. Enter the redirection URL address.
      • The root domain name of the redirection address must be the name of the currently protected domain, including a wildcard domain name.
      • You can use ${http_host} to specify the domain name and port you want to protect, for example, ${http_host}/error.html.
      Configuration examples:
      • A fixed URL: All blocked requests will be redirected to the same page. For example, http://www.example.com:8080/error.html
      • Variable replacement: This method is applicable to the scenarios where there are multiple domain names and ports. You do not need to manually change the domain name. For example, ${http_host}/error.html.
      • Redirection with parameters: This method is applicable to the scenario where you want to collect statistics on block sources. For example, ${http_host}/error.html?reason=waf_intercept

    --

    Figure 1 Default alarm page
    Figure 2 Custom alarm page (text/html)
    Figure 3 Custom alarm page (application/json)

  7. Click OK.

    After the preceding configuration is complete, you can verify the configuration. To do so, configure basic web protection by referring to Configuring Basic Web Protection to Defend Against Common Web Attacks. Note that you need to set Protective Action to Block. Then, simulate an attack and check whether the returned page is the configured one. For example, you can simulate an SQL injection attack using " <protected domain name>/?id=1 and 1=1, where id=1 and 1=1".