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!
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With