After you create a custom error page, when the requested content does not exist or an error occurs, the point of presence (POP) returns the custom error page instead of the default error page. A custom error page improves user experience and allows users to view more user-friendly error prompts.
Background information
Alibaba Cloud CDN can redirect requests to custom error pages when errors occur.
If a client requests a web service by using a browser and the requested URL does not exist, the website server returns the default 404 Not Found page. If you want to use a user-friendly error page, you can create a custom error page and specify the complete URL of the page. Requests are redirected to the specified URL based on the HTTP status code in the responses.
If the delivery of the custom error page is accelerated by Alibaba Cloud CDN, you are charged based on the billing rules of Alibaba Cloud CDN.
Supported status codes
You can create custom error pages for the following HTTP status codes: 400, 403, 404, 405, 414, 416, 500, 501, 502, 503, and 504.
Status code | Description |
400 | An error occurs when you access a page. |
403 | The server rejects the request. |
404 | A web page that does not exist on the server is requested. |
405 | The method that is specified in the request is not allowed. |
414 | The request URL is excessively long for the server to process. |
416 | The server cannot serve the requested ranges. |
500 | The server encounters an error and cannot complete the request. |
501 | The server does not support a feature that is required to complete the request. |
502 | The server that acts as a gateway or proxy receives an invalid response from the upstream server. |
503 | The server is not available. |
504 | The server that acts as a gateway or proxy does not receive a response from the upstream server within the timeout period. |
Procedure
Log on to the Alibaba Cloud CDN console.
In the left-side navigation pane, click Domain Names.
On the Domain Names page, find the domain name that you want to manage and click Manage in the Actions column.
In the left-side navigation tree of the domain name, click Cache.
Click the Custom Pages tab.
Click Customize to configure the error code and link on the custom page.
Click OK.
After you configure a custom error page, you can click Modify or Delete in the Actions column on the Custom Pages tab to modify or delete the configuration.
Examples
You want to configure a custom error page for the HTTP 404 status code. If you have saved the URL of the custom page error404.html
in the root directory of the origin server and users can visit the page by using the accelerated domain name example.aliyundoc.com
, you can use the following settings to customize an error page for the HTTP 404 status code.
HTTP status code: 404.
URL: The URL of the custom error page, such as
http://example.aliyundoc.com/error404.html
.Expected result: When a 404 error occurs, requests are redirected to the custom error page
http://example.aliyundoc.com/error404.html
.