I have a application on www.somedomain.com. Now all my files(enduser uploaded) are stored on Azure storage which has a domain like somesubdomain.blob.core.windows.net. Whenever the user wants to view the document, the public link of the document on azure is added to a iframe source and can be viewed. The only problem is that, that file in many cases is a html with Javascript inclusion, which is trying to access some basic security free variables on the parent which is originally on my first host.
Every time the html file on azure storage tries to access the parent document variables, I get the error "Blocked a frame with origin 'http://somesubdomain.blob.core.windows.net' from accessing a frame with origin "http://somedomain.com". Protocols, domains, and ports must match.'
Any guidance and help on this would be helpful.
Here's a similar answer than the one from Pier-Luc Gendreau but related to the new azure-cli v2.0.
Note that v2.0 is python based as opposed to the v1.0 which was based on Node.js.
The official installation instruction is available here, but to me, the following seems a better option to keep the system clean:
Here's an extract from the help message related to the required parameters your might want to change for your specific case.
The easiest way to enable CORS on an Azure storage account is by using the azure-cli
npm i azure-cli -g
Then, it is possible to configure CORS through the command line:
Another way to fix is to create yourself a custom domain that points to your storage files - something like filestore.somedomain.com.
You need to enable CORS on your storage account's blob service to cross-domain JavaScript access. You can learn more about Azure Storage and CORS here: https://msdn.microsoft.com/en-us/library/azure/dn535601.aspx.
I also wrote a blog post some time ago on the same, which you can read here: http://gauravmantri.com/2013/12/01/windows-azure-storage-and-cors-lets-have-some-fun/.
If you're using .Net Storage Client library, you can use code below to set CORS rule: