allBlogsList

Content Delivery Network

Website caching is one of the most beneficial technologies available. Azure CDN allows a Sitecore 9 application to serve media from a geo-located edge server.

Caching Reduces Infrastructure Consumption

  • High Availability 99.999% uptime
  • Rapid Scalability to handle peak load times
  • SSL offload handshake with the end user on behalf of the origin server
  • Edge routing TCP termination and optimize routing back to the origin server
  • Increased user satisfaction
  • Better SEO scores

CDN Request Flow

  1. Your browser requests the image from the CDN endpoint
  2. The requested content is not in the CDN endpoint
  3. CDN calls your website origin host
  4. Website returns the content and adds to CDN cache
  5. CDN returns content to user

If the content has previously been called with the same parameters, then the CDN has it in cache and returns it to the user. It is recommended to implement deployment versioning for changing content. If the content path is not changed the CDN edge servers will not return to the origin to get the new version. Good practice would be to enable the Azure CDN TTL/Cache expiry. This will purge all content on a schedule.

Cache Types

Assigning the correct cache type based on the content being served will adjust how the CDN handles caching on the edge servers. Please review the Microsoft documentation below. When initially setting up a CDN with Sitecore most of the content will be set to Cache-Control: private which will ignore the azure CDN edge servers.

https://docs.microsoft.com/en-us/dotnet/api/system.web.httpcacheability?redirectedfrom=MSDN&view=netframework-4.7.2

Managing Expiration

If an individual item needs to have a more aggressive purge, then you can set the cache-control: max-age variable to check more frequent. Please review the Microsoft documentation below.

https://docs.microsoft.com/en-us/azure/cdn/cdn-manage-expiration-of-cloud-service-content

Azure CDN Rest API

Writing a PowerShell script to run on a schedule will help with the CDN TTL/Cache expiry settings. Please review the Microsoft documentation below.

https://docs.microsoft.com/en-us/rest/api/cdn/endpoints?redirectedfrom=MSDN#Endpoints_PurgeContent

Content Delivery Network

Global Content Delivery Network from XCentium