Firefox无法在CORS资源上运行,而Chrome和Safari可以运行 [英] Firefox fails on CORS resource, while Chrome and Safari work

查看:139
本文介绍了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天全站免登陆