Updated on 2024-01-26 GMT+08:00

Browser Cache TTL

Customize the cache time to live (TTL) of client browsers to reduce the pull rate. When a user requests a resource, if the resource is cached in their browser, the resource is directly returned. Otherwise, the browser will request resource from a CDN PoP.

Precautions

  • Add up to 10 rules for each domain name.
  • Add only one rule for all files or homepage for each domain name.

Procedure

  1. Log in to Huawei Cloud console. Choose Service List > Content Delivery & Edge Computing > Content Delivery Network.

    The CDN console is displayed.

  2. In the navigation pane, choose Domains.
  3. In the domain list, click the domain name you want to modify or click Configure in the Operation column.
  4. Click the Cache Settings tab.
  5. In the Browser Cache TTL area, click Edit.
  6. In the displayed dialog box, click Add and set the browser cache policy as required.
    Figure 1 Browser cache TTL
    Table 1 Parameters

    Parameter

    Description

    Type

    • All files
    • File type: files with the specified extension names
    • Directory: files under the specified directory
    • Full path: file of the complete path
    • Homepage

    Content

    When Type is set to All files, leave this parameter blank.

    When Type is set to File type:
    • Start with a period (.) and separate file name extensions by commas (,). Do not end with a comma (,) or enter consecutive commas (,).
    • Enter up to 20 file name extensions.
    • Enter up to 255 characters.
    • File name extensions are case-insensitive.
    • Example: .JPG,.zip,.exe

    When Type is set to Directory:

    • Start with a slash (/) and separate directories by commas (,). Do not end with a comma (,) or enter consecutive commas (,).
    • Enter up to 20 directories.
    • Enter up to 255 characters.
    • Do not enter wildcards (*).
    • Example: /test/folder01,/test/folder02

    When Type is set to Full path:

    • Start with a slash (/).
    • A wildcard (*) can only follow the last slash (/).
    • Enter only one full path.
    • Enter up to 255 characters. The following special characters are not allowed: ,;|:"\
    • Examples: /test/index.html or /test/*.jpg

    When Type is set to Homepage, the root directory of a website is used. It is the top-level directory of the website folder, which contains all subfolders of the website. For example, for www.example.com/abc/file01/2.png, abc/ is the root directory.

    Priority

    Priority of the rule. Enter an integer ranging from 1 to 100. A greater number indicates a higher priority.

    Each rule must have a unique priority.

    Cache Mode

    • Honor origin Cache-Control: Comply with the cache policy of the origin server, that is, the setting of the Cache-Control header.
    • Cache: Comply with the TTL set in this rule.
    • No cache: Browsers do not cache the resources.

    TTL

    When the configured TTL arrives and a user requests the resources again, the browser requests the resources from CDN.

  7. Click OK.