Last update:2023-07-27 14:46:48
Product → Configuration → Edit Configuration → Cache Optimization
Cache Optimization function is used to improve cache performance and reduce the overload of origin servers. We support multiple optimization methods, including:
Supported Methods | Function |
---|---|
Customized Caching | Customize CDN cache rules based on different file types/directories |
Ignore-Query-String Caching | Control whether to ignore parameters after the query string (values after “?”) in the user request URL to improve cache hit ratio. |
No Cache Based on Cache-control Header | Set the cache-control response header to realize no cache for the status codes 301 and 302. |
Error Status Code Caching | Customize cache time for requests that had error response code from CDN pop or origin server, to avoid frequent requests from malicious user access. |
Dedicated Caching | Configure whether to enable compulsory caching for cold files to enhance acceleration performance. |
HTTPS/HTTP Sharing Caching | Configure to set HTTP/HTTPS to share cache rules and cache refreshing rules, that is to ignore protocol in user request |
Custom Cache Key | Configure to add a cache key which is calculated on URL request header or parameters in the request header to cache multiple copies for same URL. |
Product → Configuration → Edit Configuration → Cache Optimization → Customized Caching
CDNetworks provides this feature to specify CDN caching rules, which allows for specifying caching time and policies for different file types and resource directories, to achieve the desired CDN acceleration effect. If not set, the default caching rules will be followed.
Configure each field needed:
Explanation to the parameters:
Parameter Name | Value Description |
---|---|
Effective Range | - ‘All Requests’: meaning all requests to this domain follow the same caching rules on CDN nodes. You can also configure to set cache rules based on UA or regEx in advanced settings.You can also configure to set cache rules based on UA or regEx |
Cache Time | It configures the cache time for the selected file types. |
Ignore Case | It configures whether to ignore letter cases and only keep one case. If yes, we will only cache one file for http://www.abc.com/a.jpg and http://www.abc.com/A.jpg. If not, we will cache two files. |
Ignore No-Cache Header from Origin | It configures whether to ignore the no-cache header from origin server. |
Ignore Client Refresh | Set reload processing rules to ignore client refresh or convert to if-modified-since. |
Ignore Authorization Header | It configures whether to ignore the cache-control header in authorization request. |
Priority | The cache policies will be applied with priority from highest to lowest like 10 to 1. The larger number, the higher priority. |
Please confirm your configuration and choose Pre-deployment or Deploy Now for next step which will take 3 to 5 minutes.
Product → Configuration → Edit Configuration → Cache Optimization → Ignore-Query-String Caching
When users access resources through URLs, they may carry some parameters with special functions, such as http://www.test.com/1.jpg?version=1; https://www.test.com/guide?id=20610. CDNetworks caches the complete URL by default, which means that each different URL content will be cached. When there are many parameters, it may lead to an increase in the number of cached files, a decrease in the CDN cache hit rate, and an increase in the amount of origin traffic.
To improve the cache hit rate and reduce origin traffic, we recommend configuring the remove query string cache in the following scenario:
If the domain name accessed by the user is the same, but the parameters after the “?” are different, and these different parameters actually point to the same file, such as http://www.test.com/1.jpg?version=1; http://www.test.com/1.jpg?id=1, which represent the same image file. Please configure the remove query string cache.
Parameters to be configured:
Explanation for the parameters:
Parameter Name | Value Description |
---|---|
Effective Range | Same as Cache Optimization, see explanation above |
Ignore Query String Caching | Ignore All Query String: cache only one copy for URLs with different contents after “?”; |
Ignore Case | It configures whether to ignore letter cases and only keep one case. If yes, we will only cache one file for http://www.abc.com/a.jpg and http://www.abc.com/A.jpg. If not, we will cache two files. |
Priority | The cache policies will be applied with priority from highest to lowest like 10 to 1. The larger number, the higher priority. |
You need to confirm all of the information that you change, then choose Pre-deployment or Deploy Now for the next step which will take 3 to 5 minutes.
Product → Configuration → Edit Configuration → Cache Optimization → No Cache Based on Cache-control Header
This function configures not to cache response header 301 and 302 redirections by creating a rule to ignore those responses with location or set-cookie as a header. CDNetworks currently supports setting no-cache rules based on the Location and Set-Cookie response headers.
The following page is for configurations with many selections on the left menu, ‘Cache Optimization’ with 'No Cache Based on Cache-control Header’ configurations are included. Check the box of headers, then go next.
You need to confirm all of the information that you change, then choose Pre-deployment or Deploy Now for the next step which will take 3 to 5 minutes.
Product → Configuration → Edit Configuration → Cache Optimization → Error Status Code Caching
This feature allows you to specify the cache time based on the HTTP error status code returned by the Origin Server or CDN node, in order to avoid frequent origin requests caused by malicious user access.
This example indicates if the response code returned from CDN node or Origin server is 404 or 405, CDN node will only cache 5 seconds.
You need to confirm all of the information that you change, then choose Pre-deployment or Deploy Now for the next step which will take 3 to 5 minutes.
Product → Configuration → Edit Configuration → Cache Optimization → Dedicated Caching
This function is to configure whether to enable compulsory caching for cold files to enhance acceleration effects.
This parameter does not support self-configuration, please ask customer support for assistant.
Product → Configuration → Edit Configuration → Cache Optimization → HTTPS/HTTP Sharing Caching
This function is to set cache rule and refresh cache without the distinguish of HTTP/HTTPS protocol in user request. If the domain name is configured to ignore the protocol cache, it is recommended to also configure the ignore protocol cache refresh, because purging both the files of HTTPS and HTTP can prevent users from requesting the old files. Ignore protocol cache refresh,currently only URL purge is supported.
Ignore Protocol When Caching: if set to Yes, users can use both HTTP/HTTPs to get same file. If set to No, it means that caching follows the protocol.
Ignore Protocol When Refreshing Cache: this allow you to push a single URL to simultaneously refresh both the HTTP and HTTPS versions of the file. The default value is “No”, meaning cache refresh follows the protocol. Currently, only URL push is supported for this function.
Product → Configuration → Edit Configuration → Cache Optimization → Custom Cache Key
This function is to add a custom cache-key on the HTTP Header of all cached objects to cache multiple copies of same file.
Note:
a. Too many cache key will result in a lot of cache copies which may cause the decrease of cache hit ratio.
b. after customizing the cache through this function, the URL purge cannot be used to refresh the cache, please use directory purge.
Explanation for the parameters:
Parameter name | Description |
---|---|
Effective Range | Same as Cache Optimization, see explanation above |
HTTP Header for the Cache Key | 1)It configures which parameters in the header will be used to generate Custom Key. For example, if header =cookie,it means different cookie values will result in multiple cache copies. 2) Only one header can be configured per cache key rule. If the client needs multiple HTTP headers to be included in the cache key calculation, multiple cache key rules need to be configured. |
HTTP Header Value for the Cache Key | 1) Works in combination with HTTP header. For example, if HTTP Header for the Cache Key=cookie: userLanguage=es; eid=mx_1674690364390601; device_view=full; and HTTP header value for the cache key=userLanguage,it means create custom key based on userLanguage value in cookie. Once the userLanguage is different, CDN pops will cache the file. 2) Separate multiple value with ; . 3) Default value is null, meaning cache when header value is different. |
Priority | The cache policies will be applied with priority from highest to lowest like 10 to 1. The larger number, the higher priority. |