Azure CDN default document index.html

前端 未结 3 1581

I have now successfully setup my static website in a CDN, Is there a way to specify that index.html is the default document ? It is a 1 page site I just would like to brows

相关标签:
3条回答
  • 2021-01-18 02:42

    Based on your previous question, I am assuming that you have set CDN to map to blob storage. If this is correct, unfortunately it is not possible as of today because Azure Storage does not have a support for default document. This is one of the most requested feature on Azure Feedback - https://feedback.azure.com/forums/217298-storage/suggestions/1180039-support-a-default-blob-for-blob-storage-containers however it is still pending.

    If you want, you can create a proper website (instead of having this index.html file in blob storage) and serve that website via CDN. You can find more details about it here: https://azure.microsoft.com/en-in/documentation/articles/cdn-websites-with-cdn/.

    0 讨论(0)
  • 2021-01-18 03:01

    Microsoft is working on this. At the moment you have only two possibilities to solve this:

    • Use CDN: With the premium version of Verizon you can create rules like Redirect Rules
    • Create an Web-App which act as a proxy and serves/redirects (to) blobs

    Using Premium CDN If you purchased the premium version of Verizon CDN then you can create custom Rewrite rules. You'll find this in the "Advanced Features" section of your CDN endpoint. Once you click on "Manage" you will be redirected outside the portal where you can manage your cdn.

    Hier you must create a redirect rule like this:

    Note that each change in a rule takes about 5 hours to be activated.

    To check if your redirect rule works you can install IIS and activate the URL Rewrite Module. In the Rewrite Module you can test your rules.

    1. Open IIS
    2. Open Url Rewrite Module
    3. Add Rule
    4. Add blank rule
    5. Test Pattern

    Please note that if you test your pattern, it must begin with the CDN source path which is a number and your endpointname like /829292/movies.

    Sometimes redirect rules causes problems with CDN Purging. You can solve this isssue by adding an if clause in your rule which says that redirect should only be active if it is not the purge agent.

    0 讨论(0)
  • 2021-01-18 03:01

    This is now possible with Static websites on Azure Storage

    Creating a Static Website

    1. Navigate to your storage account
    2. Select Static Website from the blade and toggle to "enabled"

    3. Once you save, this will create a URL endpoint and also a bucket named $web to host your files

    4. Go to your $web storage container and upload any files you want

    Add CDN / Custom Domain

    1. Navigate to your CDN Profile and either Create / Edit your Endpoint
    2. Select 'Custom Origin' and use the 'Origin Hostname' that was created for your static site

    3. Give Azure up to 30 minutes to propagate all the settings

    Further Reading

    • Tutorial: Host a static website on Blob Storage
    • Tutorial: Use Azure CDN to enable a custom domain with SSL for a static website
    0 讨论(0)
提交回复
热议问题