Scheme-Based Caching
Scheme-based caching allows KeyCDN customers to cache both the HTTP and HTTPS version of an asset from the same site. This is useful for websites that may only deliver certain parts of their site (e.g. checkout page) over HTTPS while the rest of the site is delivered over HTTP.
If your site delivers assets both over HTTP and HTTPS you may consider enabling KeyCDN's Cache Key Scheme feature available in the Zone settings.
How does scheme-based caching work?
To enable scheme-based caching, navigate to your Pull Zone settings and scroll down to the Cache Key Scheme setting. Set this to enabled
and save your Zone settings (it takes a few minutes for the change to take effect).
KeyCDN will now start caching both assets which are delivered via HTTP and/or HTTPS. An asset's scheme can be identified by opening Chrome DevTools, navigating to the Network tab and selecting an asset. Then, under the Request Headers section, the :scheme
header and value will be defined, which in the case below, is https.
If your site delivers the same asset over HTTP and HTTPS, enabling the Cache Key Scheme option will allow you to cache the asset for both use-cases. Therefore non-HTTPS visitors will still be able to access the asset from the CDN once it has been cached, and vice-versa. However, enabling this feature will reduce your cache hit ratio as the edge servers will encounter a MISS if the HTTPS version of an asset is cached but not the HTTP version.
Should you enable scheme-based caching?
Scheme-based caching should only be enabled in special use-cases. The Internet is moving towards being delivered completely over HTTPS to increase security and speed, therefore it is recommended to migrate all of your HTTP URLs to HTTPS if possible. Moving to HTTPS also allows you to take advantage of the benefits of HTTP/2 and Brotli. Check out our complete guide on migrating from HTTP to HTTPS if you want to learn how to deliver your site completely over HTTPS.
That being said, in the event that you're using a legacy system or the migration process will be just too time-consuming or costly, enabling the Cache Key Scheme feature will allow you to provide your visitors with faster loading resources over HTTP and HTTPS. The Cache Key Scheme and Origin Shield features are not supported to be both enabled.