Updated on 2025-07-10 GMT+08:00

Custom Error Pages

When an error is reported during user access, an error page is displayed on the user client. You can customize the error page on the CDN console to optimize user experience.

Precautions

  • You can customize error pages for status codes 4xx and 5xx.
  • If CDN acceleration is enabled for the custom error pages, you will be billed by CDN.
  • You cannot customize error pages for domain names with special configurations.

Procedure

  1. Log in to Huawei Cloud console. Choose Service List > Content Delivery & Edge Computing > Content Delivery Network.

    The CDN console is displayed.

  2. In the navigation pane, choose Domains.
  3. In the domain list, click the target domain name or click Configure in the Operation column.
  4. Click the Advanced Settings tab.
  5. In the Custom Error Pages area, click Add.
    Figure 1 Customizing an error page
    Table 1 Parameter description

    Parameter

    Description

    Example

    Error Code

    Error code (4xx or 5xx) whose error page needs to be customized.

    404

    Action

    Break: CDN redirects requests with the specified error code returned to the destination URL. Once this rule runs, CDN skips all remaining rules.

    Redirect: CDN redirects requests with the specified error code returned to the destination URL. Once this rule runs, CDN will run any other matched rules.

    Break

    Destination URL

    When you set Action to Break, CDN uses full path match. Enter only one path, start with a slash (/), and enter up to 512 characters. Example: /errorcode.html

    When you set Action to Redirect, start the URL with http:// or https://, enter up to 512 characters, and include the complete domain name and path. Example: http://example.com/errorcode.html

    /errorcode.html

    Redirect Mode

    Required when Action is set to Redirect. Mode of redirecting the error code page to a new page. Select 301 or 302.

    301

  6. Configure the parameters and click OK.

Examples

Image abc.jpg has been deleted from the origin server and the cache on CDN PoPs has expired. When a user accesses https://example.com/abc.jpg, a status code 404 is returned. Assume that you configure the following settings on the CDN console.

Result: When another user accesses https://example.com/abc.jpg, the user will be redirected to https://example.com/error404.html.