4
votes

I've got the storage emulator running on my local machine - 127.0.0.1:10000. I've got a website running on localhost. However, when I try and do a XMLHttpRequest from the website to the emulator, I get the following error:

Origin http://localhost is not allowed by Access-Control-Allow-Origin.

It works fine if I start Chrome with the --disable-web-security option.

Now, I've read that Azure supports CORS and there's an option somewhere to turn this on. However, I cannot for the life of me figure out where the option is in the Storage Emulator.

Any help would be appreciated!

3

3 Answers

2
votes

CORS is still not supported in Windows Azure. It is coming soon though. It was demonstrated in recently concluded //Build/ conference. You can watch that video here: http://channel9.msdn.com/Events/Build/2013/3-541.

7
votes

You can use the Azure Storage Explorer to setup CORS. This works for both local (storage emulator) accounts and storage accounts in an Azure subscription.

In the storage explorer expand the account you're interested and right click on the service you'd like to set up CORS for. In this case, you'll want 'Blob Containers'. Select 'Configure CORS Settings...' from the menu.

Click 'Add' to add a rule.

CORS rule dialog in Azure Storage Explorer

If you want to automate this as part of your dev workflow, you could also set the CORS rule via the api.

For storage accounts deployed in azure, you can also use the portal.

3
votes

Windows Azure Blobs, Tables and Queues now support CORS to enable users to access/manipulate resources from within the browser serving a web page in a different domain than the resource being accessed.

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