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 storage or for Kentico Azure projects. To start using a CDN for your project, you need to:
- Create a CDN service on the Azure Management Portal.
- Enable the CDN in Kentico.
Creating a new CDN
Open the Azure Management Portal.
Click New in the bottom panel and select App services -> CDN -> Quick create.
Select the storage that is associated with your project as the Origin domain.
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.
Open the web.config file of your local project.
Add the CMSAzurePublicContainer and CMSAzureCDNEndpoint keys into the web.config file:
<appSettings> <add key="CMSAzurePublicContainer" value="true" /> <add key="CMSAzureCDNEndpoint" value="EndpointURL" /> </appSettings>
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.
Your project is now ready to use the created Azure CDN service. In the case of Azure projects, a full redeployment of your project to the Azure platform is necessary.