Cache Optimization

Last update:2023-07-27 14:46:48

  • Entrance

Product → Configuration → Edit Configuration → Cache Optimization

  • Introduction

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.

1 Customized Caching

  • Entrance

Product → Configuration → Edit Configuration → Cache Optimization → Customized Caching

  • Introduction

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.

  • Guides for operations

CDNetworks Supports Let's Encrypt Certificate

Configure each field needed:
CDNetworks Supports Let's Encrypt Certificate

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.
- ‘Only Homepage’: meaning only requests to root domain like https://domain/ follow the same caching rules.
- ‘Specified File Type’: meaning the specified file types configured follow the same caching rules. CDNetworks lists the commonly used types for selection or you can enter file types on your own.
- ‘Specified URI’: meaning only the requests to certain URLs that you configured will follow the same caching rules.
- ‘Specified Directory’: meaning only the requests to certain directories that you configured follow the same caching rules.
- ‘URL Pattern’: meaning the requests to the resources that meet the URL patterns you’ve configured will follow the same caching rules.

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.
Cache: configures the cache time for selected file type.
Follow origin cache rules: to follow the origin cache rules.
Do not cache: do not cache for the selected file type. It works as an exceptional

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.
Yes: enforce CDN pops to cache the file in regardless of no-cache header contained in the response from origin server.
No: do not cache if no-cache header is contained in response 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.
Yes: enforce CDN pops to cache the file in regardless of Cache-control:public in authorization response.
No: do not cache if there is no Cache-control:public in the response header

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.

2 Ignore Query String Caching

  • Entrance

Product → Configuration → Edit Configuration → Cache Optimization → Ignore-Query-String Caching

  • Introduction

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.

  • Guides for operations

Parameters to be configured:

CDNetworks Supports Let's Encrypt Certificate
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 “?”;
Keep All Query String: cache all copies for URLs with different contents after “?”;
Keep Some Query String: Choose whether to cache or not cache specified values 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.

3 No Cache Based on Cache-control Header

  • Entrance

Product → Configuration → Edit Configuration → Cache Optimization → No Cache Based on Cache-control Header

  • Introduction

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.

  • Guides for operations

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.

CDNetworks Supports Let's Encrypt Certificate

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.

4 Error Status Code Caching

  • Entrance

Product → Configuration → Edit Configuration → Cache Optimization → Error Status Code Caching

  • Introduction

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.

  • Guides for operations

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.

CDNetworks Supports Let's Encrypt Certificate

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.

5 Dedicated Caching

  • Entrance

Product → Configuration → Edit Configuration → Cache Optimization → Dedicated Caching

  • Introduction

This function is to configure whether to enable compulsory caching for cold files to enhance acceleration effects.

  • Guides for operations

This parameter does not support self-configuration, please ask customer support for assistant.

CDNetworks Supports Let's Encrypt Certificate

6 HTTPS/HTTP Sharing Caching

  • Entrance

Product → Configuration → Edit Configuration → Cache Optimization → HTTPS/HTTP Sharing Caching

  • Introduction

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.

  • Guides for operations

CDNetworks Supports Let's Encrypt Certificate

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.

7 Custom Cache Key

  • Entrance

Product → Configuration → Edit Configuration → Cache Optimization → Custom Cache Key

  • Introduction

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.

  • Guides for operations

CDNetworks Supports Let's Encrypt Certificate

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.
Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!