1

We have a web app that runs on Azure App Service and it has its own domain i.e. myapp.com

We now want to host all static files such as images, css and js files through Azure CDN to improve responsiveness of the app. We'll be storing all these files in our Azure storage and we've created two containers i.e. "images" and "files" containers. We also want to use our own custom domain and I'd like the URLs to be:

https://cdn.myapp.com/images for images and https://cdn.myapp.com/files for all other files.

I'm a bit confused about how to map storage containers to endpoints. When I go to the portal and select "Storage" as origin type, I see the storage account but that doesn't let me point to a particular container.

How do I map specific containers to end points?

"images" container should be available through https://cdn.myapp.com/images "files" container should be available through https://cdn.myapp.com/files

Sam
  • 26,817
  • 58
  • 206
  • 383

1 Answers1

2

You don't need to map a container to the CDN, you map the blob endpoint to the CDN

Let's say your blob endpoint is: mystorageaccount.blob.core.windows.net

The origin url should just be: mystorageaccount.blob.core.windows.net

Your static fill will be accessible by: mycdn.azureedge.net/images/image1.jpg mycdn.azureedge.net/files/text.txt

Then you can add custom domain "cdn.myapp.com" to "mycdn.azureedge.net", after that your images and files will be available through cdn.myapp.com/images/image1.jpg cdn.myapp.com/files/text.txt

  • 1
    Thank you Kuangwei. Looks like Microsoft's current approach will CDN all the containers under a storage account if it's linked to a CDN profile. This means I need to create a whole new storage account for CDN because I have other containers under the existing one and I do NOT want those containers to be CDN'ed! I thought Microsoft's approach would be much more granular. – Sam Jun 27 '16 at 16:08
  • 1
    If your container is not public, then files in there will not be CDN'ed – Kuangwei Zhang Jun 27 '16 at 22:11
  • Got it! Very useful. Thank you! – Sam Jun 27 '16 at 22:32