HTTP and HTTPS Shared Cache

Last update:2024-07-17 17:19:59

Typically, when users request the same contents using either HTTP or HTTPS protocols, the request URL only differs by the protocol, such as http://domain/index.html and https://domain/index.html, CDN servers will cache multiple copies of the same file by default, and requests with different protocols will hit distinct cache entries, even though the file content is expected to be identical in most cases.

On the CDNetworks CDN platform, you can customize whether requests that differ only by the HTTP/HTTPS protocol should be cached as the same file. Besides, you can configure whether to ignore protocol differences when purging the cache on CDN servers, thereby refreshing file resources that share the same URL (differing only by protocol).

To enhance the cache hit rate of user requests on CDN servers, it is highly recommended to configure HTTPS/HTTP Shared Cache.

How to Configure HTTPS/HTTP Shared Cache

  1. Log in to the CDNetworks Console and select the appropriate product.
  2. Navigate to the Configuration, locate the domain you wish to configure, and click on Edit Configuration at the top or the Edit button to the right of the domain CDNetworks Supports Let's Encrypt Certificate.
  3. Enter the configuration modification page, find the HTTPS/HTTP Shared Cache under Cache Optimization, and click the Add button;
  4. On the rule editing page, you can easily add the following configuration options based on your needs.
Parameter Description
Ignore Protocol When Caching The default value for this setting is No, meaning the same file URL does not ignore the HTTP/HTTPS protocol out of user requests, resulting in multiple cache entries for the same same on CDN nodes.
If you choose Yes, the CDN servers will ignore the request protocol. When a file (e.g., file A) is cached on CDN servers, requests for file A using either HTTP or HTTPS protocol will hit the same cache entry on the CDN servers.
Ignore Protocol When Refreshing Cache The default value is No, meaning when you submit a refresh task specifying an https:// file path, only the https:// cache entry on the CDN servers will be refreshed. If there is a http:// cache entry, requests using http:// will still hit the existing cache.
If you choose Yes, the protocol of the URL in the refresh task will be ignored, and both http:// and https:// cache entries on the CDN servers will be refreshed. Subsequent user requests, whether HTTP or HTTPS, will result in a cache MISS.
Currently, this configuration only applies to the URL Refresh mode.

After you have completed setting the configurations, please click OK and then select Next to submit your settings. To minimize any potential disruptions to your production environment, we strongly recommend conducting a Pre-deploy test in a staging environment. This crucial step ensures that your configurations are accurate before they go live. Once you have verified the accuracy of the settings, click Deploy Now to implement them in the live environment. The configurations typically become effective within 3-5 minutes. For comprehensive guidance on pre-deployment testing and to verify the effectiveness of your configurations, please consult the tutorial Deploy the Configurations to Staging Environment for Validation.

Notes

If you set Ignore Protocol When Caching to Yes, Ignore Protocol When Refreshing Cache could only be set to Yes by default and could not configure No. Otherwise, since you configure to ignore protocol to cache contents on CDN server, user requests either with HTTP or HTTPS protocol will hit the cache, but the CDN servers might caches the contents with the HTTP protocol. However, the refresh task you submit uses the HTTPS protocol and if you don’t ignore protocol to refresh caches, the HTTP protocol cache entry will not be refreshed, and user requests will still hit the old cached file (if it is within the cache validity period).

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!