How to access XML hosted as azure blob from azure website

左心房为你撑大大i 提交于 2019-12-11 18:33:20

问题


I'm currently looking into problem: We have a backend application that creates XML files with content and stores them as Azure Blobs (we cannot change this).

Blob sample url: http://mytestaccount.blob.core.windows.net

We are implementing a webpage that consumes those XML files.

Our current solution is static webpage (no iis or any other server required) hosted on the same blob as mentioned XML files.

Question 1: Is there a way to redirect a domain name to our webpage hosted currently as blob?

We thought about hosting our web application not as Blob but using Azure Web Sites. This creates a problem of cross-domain requests (we have to get those XML files).

Website sample url: http://mytestpage.azurewebsites.net

Question 2: Is there a way to download XML by jquery ajax call from such a webpage (hosted as Azure Web Page) to xml stored as Blob?


回答1:


Question 1: Is there a way to redirect a domain name to our webpage hosted currently as blob?

Yes, it's certainly possible to do so however there're some limitations currently. Please see this link regarding configuring a sub-domain which points to blob storage: http://msdn.microsoft.com/en-us/library/windowsazure/ee795179.aspx. Please note that currently you don't get an option to specify default document for your website with this approach.

Question 2: Is there a way to download XML by jquery ajax call from such a webpage (hosted as Azure Web Page) to xml stored as Blob?

Reading the blob would not cause cross-domain request issues. Cross domain issue would come when you're trying to post/put some content in your blob storage.

As long as your blob container is public, you should be able to access the blob without any issues. It's a simple GET. However if your blob container is private, then you would need to create a shared access signature URI on the blob with "Read" permission and use that URI in your jQuery AJAX call.

UPDATE: Reading a blob via jQuery AJAX call would give a "Cross Domain" error.



来源:https://stackoverflow.com/questions/15135089/how-to-access-xml-hosted-as-azure-blob-from-azure-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!