Updated on 2024-07-08 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.

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

    Redirect Mode

    Mode of redirecting the error code page to a new page. The options are 301 and 302.

    301

    Destination URL

    New page to which the error code page is redirected. The value must start with http:// or https://.

    https://example.com/error404.html

  6. Configure the parameters and click OK.

Example

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.