How to set same domain name for Azure Storage and Hosted Service

I have a web application running on azure and using azure storage with blob. My application allows to edit html files that are in the azure storage to save with another name and publish them later. I am using javascript to edit the html content that I display in an Iframe but as the domain of my web application and the html that I try to edit are not the same, I got and this error "Unsafe JavaScript attempt to access frame with URL "URL1" from frame with URL "URL2". Domains, protocols and ports must match". I have been doing some research about it and the only way to make it work is to have the web application and the html that I want to access using javascript under the same domain. 

So my question is: is it possible to have the same domain name in azure for the hosted service and the storage.

 

Like this:

hosted service: example.com

storage: example.com

 

By the way I already customize the domain names so they looks like this:

hosted service <mydomainname>.com

storage <blob.mydomainname>.com

 

Actually I have my application running in another hosting and I have no problem there since I have a folder where I am storing the files that I am editing so they are in the same domain as the application. I have been thinking in to do the same with Azure, at least to have a folder where I can store the html file meanwhile I am editing it but I am not sure how much space I have in the hosted service to store temporary files.

let me know if you have a good tip or idea about how to solve this issue.

 


  • Edited by Rodrigo Sedano Tuesday, July 05, 2011 1:09 PM change title
July 5th, 2011 4:09pm

Both blobs and applications support custom domains (CNAME records). For example, my blog is at blog.smarx.com, and files I host there are at files.blog.smarx.com (and the CDN in front of those is at cdn.blog.smarx.com).
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2011 8:23pm

I saw you blog when I started testing the blob and I followed the steps there to create the custom domain. But look like I can not have the same domain name for my application and the blob.

As I explained before I have an iframe in my application where I am loading and editing a html page that it is in the azure storage, the editing of the html page it is done on the flight using some javascript code (jquery). I have a cross domain problem where I have the A domain trying to access to the B domain.

For that reason, I would like to find a way to storage my html page that I need to edit under the same domain. I have been looking into the LocalStorage but I am afraid that It can be also a problem since it is per instance of a role and the data stored there could be delete at some point and it is not persisting.

I have my application running in production on a ASP.Net hosting provider where it is working well and I am using just a folder under IIS to store the html file that I need to edit and store.

 

I hope that I gave a better explanation about the issue :)

 

July 6th, 2011 12:21am

Hi Rodrigo,

Though both Azure Blob and Azure applications support custom domain, one domain could have only one DNS record (in this case is CNAME record) at one time. For Steve's case, he has 3 domains, blog.smarx.com, files.blog.smarx.com and cdn.blog.smarx.com.

> I would like to find a way to storage my html page that I need to edit under the same domain.

For this case, a workaround will be adding a http handler in your Azure application to serve file requests. That means we do not use the actual blob url to access blob content but send the request to a http handler then the http handler gets the content from blob storage and returns it.

Please check Accessing blobs in private container without Shared Access Secret key for a code sample.

Thanks.

Free Windows Admin Tool Kit Click here and download it now
July 6th, 2011 10:22am

Thanks Wenchao it worked perfect :)
July 7th, 2011 6:12pm

CORS is available now...  try searching on the word CORS for examples...

http://gauravmantri.com/2013/12/01/windows-azure-storage-and-cors-lets-have-some-fun/

http://msdn.microsoft.com/en-us/library/windowsazure/dn535601.aspx

Free Windows Admin Tool Kit Click here and download it now
January 28th, 2014 2:26am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics