ApsaraVideo VOD allows you to configure the validity period for status codes of static resources in specific directories or with specific filename extensions. This way, CDN nodes directly return HTTP status codes to requests, and the loads on the origin server are reduced. This topic describes how to configure the validity period for status codes.

Scenario

Normally, the origin server returns an HTTP 2xx status code to the CDN nodes if CDN nodes have retrieved the requested resources from the origin server. Then, the CDN nodes process the requests based on cache expiration rules. If the origin server fails to return an HTTP 2xx status code to the CDN nodes, and you do not want the origin server to respond to every request, you can configure a validity period for HTTP status codes. This way, CDN nodes directly return HTTP status codes to requests, and the loads on the origin server are reduced.

Note
  • CDN nodes do not cache the following HTTP status codes: 303, 304, 401, 407, 600, and 601.
  • If the Cache-Control header is configured on the origin server, CDN nodes cache the following HTTP status codes based on the Cache-Control header: 204, 305, 400, 403, 404, 405, 414, 500, 501, 502, 503, and 504. If you do not configure a validity period for these HTTP status codes, the validity period is one second by default.

Procedure

  1. Log on to the ApsaraVideo VOD console.
  2. In the left-side navigation pane of the ApsaraVideo VOD console, choose Configuration Management > CDN Configuration > Domain Names to go to the Domain Names page.
  3. On the Domain Names page, select the domain name that you want to configure, and click Configure in the Actions column.
  4. In the left-side navigation pane of the specified domain, click Cache.
  5. Click the Status Code Validity tab.
  6. On the page that appears, click Add.
    Status code validity
    Parameter Description
    Type You can select Directory or Filename Extension based on your business requirements.
    Note If you configure a validity period for the HTTP status codes of both a directory and files with specific extensions, the rule that is earliest created takes effect. All other rules are ignored.
    Address
    • If you select Directory, take note of the following rules:
      • You can add only one directory to each rule.
      • You can enter a full path. The path must start with a forward slash (/). Example: /directory/aaa.
    • If you select Filename Extension, take note of the following rules:
      • You can enter one or more filename extensions. Separate multiple filename extensions with commas (,). Example: JPG,TXT.
      • You cannot use an asterisk (*) to match all file types.
    Status Code Validity Settings Separate multiple status codes with commas (,). Unit: seconds.
    • You can configure a validity period for 4xx and 5xx status codes. Example: 4xx=10,5xx=15.
    • You cannot configure a validity period for 2xx and 3xx status codes. You can configure a validity period only for the specific status codes. Example: 201=10,302=15.
  7. Click OK.

    After you configure a validity period for status codes, you can Modify or Delete the configurations on the Status Code Validity tab.