Status Code Cache TTL

Last update:2026-04-28 16:10:07

Based on HTTP status codes returned from your origin server, you can perform simple custom settings on CDNetworks CDN platform, to specify cache TTL of error page corresponding to those status codes on CDN servers. This setting can help significantly reduce the load on your origin server by minimizing frequent back-to-origin requests when CDN servers do not have a cached response to some malicious user requests. By default, CDN servers do not cache error message pages returned by your website for error status codes.

How to Configure Status Code Cache TTL

  1. Log in to the CDNetworks Console and select the appropriate product.
  2. Navigate to the Configuration, locate the domain you wish to configure, and click on Edit Configuration at the top or the Edit button to the right of the domain image.png.
  3. Enter the configuration modification page, find the Status Code Cache TTL, and click the Add button;
  4. On the rule editing page, you can easily add the following configuration options based on your needs.

The configurable items are as follows:

Parameter Description
Status Code Enter origin response status codes 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 TTL Configure the cache TTL for the error message page corresponding to the above status codes on CDN servers, currently supported time units are seconds,minutes and hours. The default unit is seconds.
If the cache TTL 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 production 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.

Best Practices

Example 1: Configuring Cache TTL 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 CDN, the error message page will be cached on CDN servers for 10 minutes. During this cache TTL, if another user makes a similar request, CDN servers will directly return the cached error message page.


Notes

If you configure a long cache TTL for the error message page on CDN servers, CDN servers will return the cached page directly to your users within that cache TTL. Therefore, exercise caution when setting the cache TTL in the rules if you intend to return a different specific file to clients within a shorter timeframe.

Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!