am当前在使用Android 4.4上的发行版时遇到Ionic 1的问题。我不断收到cors
错误。另外,我正在使用已经在其中指定了cors
个请求的node.js后端。到目前为止,这是我看到的错误:
SEC7121:[CORS]当跨域资源“ {”的凭据模式为*
时,源http://localhost:8100在Access-Control-Allow-Origin
响应头中找到include
{3}}”。
在此方面的任何帮助将不胜感激。
答案 0 :(得分:0)
将其添加为node.js服务器中的中间件。
这将允许带有凭据的跨源请求
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "http://localhost:8100");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
res.header("Access-Control-Allow-Methods", "GET, POST,PATCH, DELETE, PUT");
res.header("Access-Control-Allow-Credentials", true);
next();
});