Cache expiration configuration refers to a set of expiration policies the CDN cache nodes should follow when caching your business contents.
All resources cached on CDN nodes have an expiration time. For unexpired resources, when a request reaches the node, the node will directly return the requested resource to the user, so as to speed up the resource acquisition. For expired resources, the node will forward the user request to the origin server, reacquire the resource and cache it to the node, and then return it to the user. A reasonable cache validity period can effectively improve the resource hit rate and lower the origin-pull rate, reducing bandwidth usage.
Log in to the CDN Console and click Domain Management on the left sidebar to enter the management page.
Locate and click the domain name you want.
In the Cache Configuration tab, find the Browser Cache Validity Configuration section and toggle on the Browser Cache switch to enable it.
The following results are then achieved.
When a user requests for a certain resource from the origin server and the Response HTTP Header includes the
Cache-Control field with a value of
max-age=xxxx, the cache validity period for the resource on the node take the lesser of the value of the set validity period or the
max-ageset for the
/index.htmlof the origin server is 200 seconds and the cache validity period set for CDN is 600 seconds, the actual cache validity period for the file will be 200 seconds.
max-ageset for the /index.html of the origin server is 800 seconds and the cache validity period set for CDN is 600 seconds, the actual cache validity period for the file will be 600 seconds.
Cache-Controlfield does not exist in the response header of your origin server, the
Cache-Control:max-age=600header will be used by default.
Tencent Cloud CDN supports the
Cache-Control configuration on the origin server by default, but configuration of the
Cache-Control header is not supported.
max-age cannot be configured on CDN nodes, but CDN nodes can inherit the origin server's
max-age. To configure
max-age on CDN nodes, you only need to configure the
max-age on the origin server.
For more information, please see the directions in Node Cache Configuration.
You can configure different cache validity periods for different types of directories and files. If the cache validity period is configured to 0, the CDN node will not cache the resource, in which case the CDN node needs to pull related resources from the origin server every time the users send access request to the node. For more information on cache configurations, please see Node Cache Configuration.
Tencent Cloud CDN supports cache validity period configuration at various dimensions, custom priority adjustment, and cache inheritance policies (advanced cache configuration). A reasonable cache validity period can effectively improve the resource hit rate and lower origin-pull rate, reducing bandwidth usage.
Default configuration is as follows when a domain name is connected:
When a user makes a request for a certain business resource, the origin server's Response HTTP Header includes the
Cache-Control field. The default policy is as follows:
max-age, the cache validity period for this resource is subject to the period set for the resource, and will not inherit the value specified by
no-store, the CDN node does not cache the resource.
When multiple caching policies are set, the priorities of the entries are determined on a bottom-to-top basis, with the entry at the bottom of list having the highest priority and the one at the top having the lowest priority. For example, suppose the following caching policies are set for a domain name:
All files (30 days) .php .jsp .aspx 0 seconds .jpg .png .gif 300 seconds /test/*.jpg 400 seconds /test/abc.jpg 200 seconds
If the domain name is
www.test.com, and the resource is
www.test.com/test/abc.jpg, the matching rule will be as follows:
The final cache validity period is subject to the last matching result, and so it will be 200 seconds.