Configuring Azure CDN

A Content Delivery Network (CDN) can improve the performance of your websites running in the Azure environment. By replicating the contents of your Blob storage across multiple data centers around the world, Azure CDN can speed up delivery of static content, such as images or stylesheets, as well as streaming media. See Using CDN for Azure for details.

You can utilize an Azure CDN service for Kentico projects configured to use Azure Blob storage and for Kentico Azure projects running in Cloud Services. To start using a CDN for your project, you need to:

  1. Create a CDN service on the Azure Management Portal.
  2. Enable the CDN in Kentico.

Creating a new CDN

  1. Open the Azure Management Portal.

  2. Click New in the bottom panel and select App services -> CDN -> Quick create.

  3. Select the storage that is associated with your project as the Origin domain.

    Creating a new Azure CDN

  4. Click Create.

The system creates a new CDN. When the CDN is created, note down its CDN endpoint URL.

Note that it may take up to 60 minutes for the service to propagate through the CDN network. You may receive error code 400 (Bad Request) during this time.

Configuring Kentico to use a CDN

After you create a CDN using the management portal, you need to register the CDN in your Kentico project to start using this service.

  1. Open the web.config file of your local project.

  2. Add the CMSAzurePublicContainer and CMSAzureCDNEndpoint keys into the web.config file:

    
    
    
     <appSettings>
         <add key="CMSAzurePublicContainer" value="true" />
         <add key="CMSAzureCDNEndpoint" value="EndpointURL" />
     </appSettings>
    
    
     
  3. Replace EndpointURL with the value from your created CDN – in the Azure Management Portal, open your CDN service, locate the CDN Endpoint URL and copy it as a value for the CMSAureCDNEndpoint key.

    If your site runs under HTTPS, we recommend you always specify the EndpointURL with the HTTPS protocol as well.

    For example: https://az665192.vo.msecnd.net/

    Not doing so may result in Mixed Content warnings being logged in your web browser’s console when retrieving files from the CDN.

    Locating the CDN Endpoint URL

Your project is now ready to use the created Azure CDN service. If your site is running on Azure, a full redeployment of your project to the Azure platform is necessary.