Cache Key Rule Configuration

Last updated: 2020-12-09 14:33:57

    Note:

    The Ignore Query String and Cache Ignore URL Case configurations have been merged into the Cache Key Rule configuration, which now supports more refined configurations.

    Configuration Overview

    Tencent Cloud CDN uses the Key-Value format to map resources during caching, where Key is the cache key and a unique identifier of the cached resource. By configuring cache key rules, you can configure the Ignore Query String and Cache Ignore URL Case features for the content of different file types to optimize cache keys.

    Ignore Query String

    • When a user accesses the resource through a URL, the access request may carry some parameters for special purposes. For example, the following URLs are used to represent two different images:
      http://cloud.tencent.com/1.jpg?version=1
      http://cloud.tencent.com/1.jpg?version=2
      In this scenario, you need to disable Ignore Query String and use a complete URL as the cache key to cache images and distinguish between resources.

    • If you use the timestamp signature parameter for access authentication in an audio/video scenario:
      http://cloud.tencent.com/1.mp4?sign=XXXXXX
      In this scenario, you need to enable Ignore Query String and use the URL part before "?" (i.e., http://cloud.tencent.com/1.mp4) as the cache key. The node will then only cache one resource, and the cache can be directly hit through signature authentication even if the timestamp signature keeps changing.

    Cache Ignore URL Case

    If the letter case of resource URL paths is relevant to the resource content in your business, you can disable "Cache Ignore URL Case".
    If the letter case of resource URL paths is irrelevant to the resource content in your business, you can enable "Cache Ignore URL Case" to improve the hit rate.

    Note:

    The platform is being upgraded and Cache Ignore URL Case cannot be enabled currently.

    Configuration Guide

    Viewing the Configuration

    Log in to the CDN console, select Domain Management on the left sidebar, and click Manage on the right of a domain name to enter its configuration page. Select the Cache Configuration tab to find Cache Key Rule Configuration section.

    When adding an acceleration domain name, the Ignore Query String is enabled or disabled by default based on different acceleration business types.

    • If static acceleration is selected, the Ignore Query String is disabled by default. In the cache key configuration, the Ignore Query String of all file rules will be synced to Do Not Filter.
    • If downloading or streaming VOD acceleration is selected, the Ignore Query String is enabled by default. In the cache key configuration, the Ignore Query String of all file rules will be synced to Filter All.

    Adding Rules

    You can add cache rules as needed.

    Configuration limitations

    • Each domain name can be configured with up to 20 cache key rules (including the default ones).
    • Rule priority can be adjusted: rules at the bottom of the list have higher priority (the priority of default rules cannot be adjusted).
    • In each rule of specified file type, folder, and full-path file, up to 100 groups of contents can be entered. Please use ";" to separate different contents, e.g., "Specified file type - jpg;png".
    • Ignore Query String - Reserve Specified Parameters.
      • All files: up to 6 parameters can be entered; each one can contain up to 20 characters.
      • Specified file type/folder/full path: up to 5 parameters can be entered; each one can contain up to 20 characters.

    Modifying Rules

    You can click Modify to modify the added cache key rules.

    Note:

    The default rules support modifying Ignore Query String and Cache Ignore URL Case configurations, while the type and content cannot be modified.

    Deleting Rules

    You can click Delete to delete the added cache key rules (except the default ones).

    Configuration Samples

    The cache key rule configuration of the acceleration domain name www.test.com is as follows:

    Then the actual access will be as follows:

    A client accessed the resources www.test.com/abc.jpg?version=1&colour=red and www.test.com/abc.JPG?version=1&colour=red, the two requests arrived at the CDN node X, on which the resources are not cached.

    • The origin server will be pulled for the image abc.jpg, and the image will be cached on the CDN node X. As Ignore Query String is enabled and Filter All is selected, the URL part www.test.com/abc.jpg before "?" will be used as the cache key.
    • The client accessed the resource www.test.com/abc.JPG?version=1&colour=red, and as the Cache Ignore URL Case is disabled, the cached resource www.test.com/abc.jpg will not be hit, the origin server will be pulled for the image abc.JPG, the image will be cached on the CDN node X, and www.test.com/abc.JPG will be used as the cache key.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help