我在Azure帐户上设置了一个新的blob存储帐户,并使用以下配置将其配置为允许CORS:
serviceProperties.Cors = new CorsProperties();
serviceProperties.Cors.CorsRules.Add(new CorsRule()
{
AllowedHeaders = new List<string>() { "*" },
AllowedMethods = CorsHttpMethods.Put | CorsHttpMethods.Get | CorsHttpMethods.Head | CorsHttpMethods.Post | CorsHttpMethods.Delete,
AllowedOrigins = new List<string>() { "*" },
ExposedHeaders = new List<string>() { "*" },
MaxAgeInSeconds = 1800 // 30 minutes
});
然而我仍然从我的js代码中得到以下错误:
Origin <MY-SITE-URL> not found in Access-Control-Allow-Origin header
查看图像的响应标题,我看到:
Access-Control-Allow-Origin: *
那为什么它不起作用?
答案 0 :(得分:1)
您是否将xmlhttprequest上的withCredentials属性设置为true?如果是,浏览器将拒绝通配符Access-Control-Allow-Origin。
请查看以下链接以获取更多有用信息: