Alibaba Cloud Content Delivery Network (CDN) allows you to set a time-to-live (TTL) value for HTTP status codes to expire static resources of specified file types or under specified directories. When a specified HTTP status code expires, relevant resources are deleted from CDN nodes. This topic describes how to create a TTL rule for HTTP status codes.

Background information

When you set a TTL value for HTTP status codes, take note of the following rules:
  • The system does not cache the following HTTP status codes: 303, 304, 401, 407, 600, and 601.
  • If the response returned by the origin server carries the HTTP status code 204, 305, 400, 403, 404, 405, 414, 500, 501, 502, 503, or 504 and the Cache-Control header, the TTL value of the HTTP status code is specified by the Cache-Control header. If the response does not carry an HTTP status code, the default TTL value is one second.
  • If you have set a status code TTL for resources of specified file types and for resources under specified directories, whichever created first takes effect.

Procedure

  1. Log on to the Alibaba Cloud CDN console.
  2. In the left-side navigation pane, click Domain Names.
  3. On the Domain Names page, find the domain name that you want to manage and click Manage in the Actions column of the domain name.
  4. In the management pane of the domain name, click Cache.
  5. Click the Status Code Expiration tab.
  6. On the Expire In tab, click Create Rule. In the Create Expiration Rule dialog box, specify the object and the TTL value of HTTP status codes.
    You can choose to specify directories or file extensions.
    Type Note
    Directory
    • Each directory must start with a forward slash (/), for example, /directory/aaa.
    • You must set a TTL value for specific HTTP status codes, such as 201, 302. Formats such as 2xx and 3xx are not supported.
    File Extension
    • Separate multiple file extensions with commas (,), for example, txt,jpg.
    • Asterisks (*) cannot be used as wildcard characters to match all file types.
    • You must set a TTL value for specific HTTP status codes, such as 201, 302. Formats such as 2xx and 3xx are not supported.
  7. Click OK.

    You can click Modify or Delete in the Expire In column to modify or delete a rule.