Firefox中的CORS请求被阻止

时间:2019-03-20 17:41:28

标签: firefox cors xmlhttprequest

我正在尝试向我的服务器发出CORS请求。我的服务器已正确启用CORS。

我要发送一个附加标头,以便浏览器发送预检的选项调用。

这在Chrome中有效,但在Firefox中无效。在firefox中,我可以看到带有200的options调用作为返回状态代码,但是随后的get调用没有发送,这在Chrome中非常完美

在firefox中,我在控制台中看到这些消息

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://serverurl. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘https://tryit.w3schools.com, *’).[Learn More]

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://serverurl. (Reason: CORS request did not succeed).[Learn More]

我正在调用XMLHttpRequest来触发该调用。

我无法弄清为什么在Firefox中通话失败

1 个答案:

答案 0 :(得分:-1)

发现了问题。这是因为扩展了“允许交叉原点”。禁用它即可。

Firefox fails on CORS resource, while Chrome and Safari work重复