Egg 如何支持单个接口可跨域请求,而非该服务所有接口均可被跨域请求~尝试了如下方法:async XXX () { const { ctx } = this;
ctx.set('Access-Control-Allow-Origin', '*');
ctx.set('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, token');
ctx.set('Access-Control-Allow-Credentials', true);
ctx.set('Access-Control-Allow-Methods', 'GET, POST, PUT, OPTIONS, DELETE');
...
}但:求赐教~
添加回答
举报
0/150
提交
取消