微信 web 开发者工具,跨域调用资源的时候报错
发布于 5 年前 作者 guiyingqian 4782 次浏览 来自 问答

错误一

XMLHttpRequest cannot load https://test.com/ws/target. The ‘Access-Control-Allow-Origin’ header contains multiple values ‘https://a.com, *’, but only one is allowed. Origin ‘https://a.com’ is therefore not allowed access.

错误二

XMLHttpRequest cannot load https://api.growingio.com/v2/zzzaaa/web/action?stm=1489659172277. A wildcard ‘*’ cannot be used in the ‘Access-Control-Allow-Origin’ header when the credentials flag is true. Origin ‘https://a.com’ is therefore not allowed access. The credentials mode of an XMLHttpRequest is controlled by the withCredentials attribute.

2 回复

可否截图看下具体的报错信息

我也遇到一样的问题,提问的人已经写的很清楚了,控制台打印的就是那些。核心内容就是 A wildcard ‘*’ cannot be used in the ‘Access-Control-Allow-Origin’ header when the credentials flag is true.  

单问题是服务端根本没有返回 Access-Control-Allow-Origin ‘*’ ,而是直接返回的前端页面的域名

回到顶部