Last update:2024-07-17 17:19:58
Based on the HTTP error status codes returned from your origin server, you can perform simple custom settings on the CDNetworks CDN platform, to specify the cache duration of the error message page corresponding to those status codes on the CDN servers. This setting can help significantly reduce the load on your origin server by minimizing frequent back-to-origin requests when the CDN servers does not have a cached response to some malicious user requests. By default, CDN servers do not cache the error message pages returned by your website for error status codes.
The configurable items are as follows:
Parameter | Description |
---|---|
Status Code | Enter the origin response status code for which the CDN servers should cache the error message page. The platform supports the following status codes: 204; 305; 400; 403; 404; 405; 414; 416; 423; 429; 500; 501; 502; 503; 504 . Note: By default, the error message page for a 404 status code is cached for 1 minute. |
Cache Time | Configure the cache duration for the error message page corresponding to the above status codes on the CDN servers, currently supported time units are seconds,minutes and hours. If the cache duration is set to 0, the page will not be cached on the CDN servers. |
After you have completed setting the configurations, please click OK and then select Next to submit your settings. To minimize any potential disruptions to your production environment, we strongly recommend conducting a Pre-deploy test in a staging environment. This crucial step ensures that your configurations are accurate before they go live. Once you have verified the accuracy of the settings, click Deploy Now to implement them in the live environment. The configurations typically become effective within 3-5 minutes. For comprehensive guidance on pre-deployment testing and to verify the effectiveness of your configurations, please consult the tutorial Deploy the Configurations to Staging Environment for Validation.
Example 1: Configuring Cache Duration for Error Message Page with Origin Response Status Code 403 or 404
For the associated accelerated domain with this rule, when a user request triggers a response with status code 403
or 404
from the origin server via the CDN, the error message page will be cached on the CDN servers for 10 minutes. During this cache duration, if another user makes a similar request, the CDN node will directly return the cached error message page.
If you configure a long cache duration for the error message page on the CDN servers, the CDN servers will return the cached page directly to your users within that cache period. Therefore, exercise caution when setting the cache duration in the rules if you intend to return a different specific file to clients within a shorter timeframe.