Azure Blob存储请求的资源错误上没有Access-Control-Allow-Origin标头

时间:2016-03-23 02:38:36

标签: javascript azure blob storage

我一直遇到在Azure Blob存储上传的问题。我能够生成SAS令牌但是当我请求上传时,它会返回错误说:

XMLHttpRequest cannot load 
https://mycureresources.blob.core.windows.net/resources/test.jpeg?st=2016-0…BZj6%2FKcVWRvoLXkKfa109EV6%2FYuwmTs%3D&comp=block&blockid=YmxvY2stMDAwMDAw. 
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' 
header is present on the requested resource. Origin 'http://czar.opie.com:3210' is therefore not allowed access.
The response had HTTP status code 403.

1 个答案:

答案 0 :(得分:0)

简单来说,这是服务器端代码中的配置,您正在从浏览器请求。允许CORS请求到" *"或者您正在浏览的特定IP。事实上,这是SOP(Same-Origin-Policy)的一个很好的特性。浏览器不允许来自Access-Control-Allow-Origin标头中未提及的其他来源的请求。