问题
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
回答1:
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
来源:https://stackoverflow.com/questions/38001373/setting-up-azure-cdn