Getting your files faster to your clients is very important. There are various options for this. Last year, we started to look into Azure CDN to quickly and reliably provide our source files to our customers. The Azure CDN is put in front of an Azure Storage account on which we host the files in different blob containers.
Azure CDN is highly configurable but has one major downside, its variable pricing. By variable I mean, that it will depend on the actual usage. We calculated that we would quickly pay over โฌ 1000 to serve the files each month to serve our project’s files. We got this number from the Azure calculator, and it gives you a good estimation.
Suddenly it struck me that we might be able to make use of Cloudflare. As they have fixed price offerings, you know what you will be paying each month. The process for setting up Cloudflare for providing your Azure Storage blobs is relatively easy.
Cloudflare configuration
Go to Cloudflare, and register your domain. If you already have a registered domain, go to the DNS tab, and configure a CNAME record as follows:
- Type:
CNAME
- Name:
cdn
(or anything you want) - Target:
<azure-storage-account>.blob.core.windows.net
ImportantIn the target, you need to add your name from the Azure Storage account.
Once you configured this record, you can set up this custom domain on your Azure Storage Account.
Setting up a custom domain for your Azure Storage account
On the Azure Storage portal, open your Azure Storage Account. Under Blob service you will find the Custom domain link.
Once you filled in your domain name, you are all set in my case cdn.eliostruyf.com
.
ImportantIt can take some time before the record is available, so go and grab a coffee first.
That is all you need to do to configure Cloudflare CDN to use it for your Azure Storage Account.