Firefox 在 CORS 资源上失败,而 Chrome 和 Safari 工作 [英] Firefox fails on CORS resource, while Chrome and Safari work

查看:19
本文介绍了Firefox 在 CORS 资源上失败,而 Chrome 和 Safari 工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由 CouchDB 安装支持的看似正确的资源.请求是使用 JS Axios 发出的.Chrome 和 Safari 都可以工作,但 Firefox 65.0 失败了

I have a seemingly correct resource backed by a CouchDB installation. Requests are made using JS Axios. Both Chrome and Safari work, Firefox 65.0 fails however with

CORS header 'Access-Control-Allow-Origin' does not match 'http://localhost:8080, *'

实际上,服务器 (CouchDB) 并没有提供

The server (CouchDB) does, in fact, not deliver

 'http://localhost:8080, *' as Access-Control-Allow-Origin 

但是

 Access-Control-Allow-Origin http://localhost:8080
 Access-Control-Expose-Headers content-type, cache-control, a…e-newrev, x-couchdb-body-time

由于其配置 CORS 接受来自所有域 ('*') 的请求.

due to its configuration CORS accept requests from all domains ('*').

如前所述,这对于其他浏览器来说是完美的.但 Firefox 失败.我真的似乎没有找到原因.对此的解决方案,并不断想知道额外的*"从何而来,Firefox 想知道.

This, as mentioned, perfectly works for the other browsers. But fails for Firefox. I really don't seem to find the resason resp. a solution for this, and keep wondering where the additional '*' comes from that, Firefox wants to see.

推荐答案

@sideshowbarker 感谢您的提示 - 实际上,该行为是由于扩展 - 即这个 https://addons.mozilla.org/en-US/firefox/addon/cross-domain-cors/ 禁用此扩展程序后,cors 按预期工作!

@sideshowbarker thanks for the hint - indeed, the behaviour was due to an extension - namely this one https://addons.mozilla.org/en-US/firefox/addon/cross-domain-cors/ after disabling this extension cors worked as expected!

这篇关于Firefox 在 CORS 资源上失败,而 Chrome 和 Safari 工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆