Nodejs解决所有跨域请求

 

app.use(function(req, res, next) {
  res.setHeader('Access-Control-Allow-Origin', '*');
  res.setHeader('Access-Control-Allow-Methods', 'GET, POST');
  res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type, Authorization');
  next();
});

 

相关文章:

  • 2022-02-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-23
  • 2021-07-29
  • 2021-07-14
  • 2021-10-23
  • 2022-02-08
  • 2022-12-23
  • 2021-06-27
相关资源
相似解决方案