2
votes

There are two ways of making a blob container accessible via CDN.

The first way is to point the CDN directly to the blob container, documented here: https://docs.microsoft.com/nl-nl/azure/cdn/cdn-create-a-storage-account-with-cdn

Origin type: Storage 
Origin hostname: NAME.blob.core.windows.net.  
Origin host header: NAME.blob.core.windows.net.  
Origin path: /www (container name)

The second way is to map the $web blob container "static website" url to your CDN, documented here: https://docs.microsoft.com/nl-nl/azure/storage/blobs/static-website-content-delivery-network

In this scenario you need to enable the "static website" option on your storage account. Example configuration of a CDN endpoint:

Origin type: Custom Origin
Origin hostname: NAME.z6.web.core.windows.net (static website public url)
Origin host header: NAME.z6.blob.core.windows.net (static website public url)
Origin path: (empty)

Both methods map a blob container to the CDN endpoint. But the 2nd option has an additional, possibly unneeded, static website endpoint.

Can somebody explain the use-cases? It seems like the static website method is less flexible as you need to use the $web container specifically.

1

1 Answers

3
votes

It seems like the static website method is less flexible as you need to use the $web container specifically.

There are two distinct advantages you get out of hosting static website in Azure Storage:

  1. Support for default document: In this case you can directly use NAME.z6.web.core.windows.net to serve the default document otherwise you will have to specify the full path like NAME.blob.core.windows.net/container/index.html, and
  2. Custom error page for 404 error: You can have a custom 404 error page when hosting your static website in $web container otherwise you get standard 404 error message if a blob is not available in the blob container.

These things are not available when you host a static website in any other blob container.