美文网首页
跨域问题

跨域问题

作者: Meteor__ | 来源:发表于2017-07-13 14:26 被阅读0次

1.跨域forbidden 状态码405

使用egg-cors

npm install egg-cors --save

plugin.js中添加配置

exports.cors = {
  enable: true,
  package: 'egg-cors',
};

config.default.js中添加配置

config.cors = {
  allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH'
}

2.POST请求失败,变成options请求

相关文章

网友评论

      本文标题:跨域问题

      本文链接:https://www.haomeiwen.com/subject/nquihxtx.html