Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Azure Storage Emulator - CORS support

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!

like image 621
Jason Manson Avatar asked Dec 16 '22 09:12

Jason Manson


1 Answers

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.

like image 72
Eric Avatar answered Jan 21 '23 22:01

Eric