前端要在本地测试ajax接口,无法跨域访问,所以在测试环境的nginx配置了跨域支持,方法如下:

在nginx.conf文件, http块下配置

42 #support cross domain access
43 add_header Access-Control-Allow-Origin *;
44 add_header Access-Control-Allow-Headers X-Requested-With;
45 add_header Access-Control-Allow-Methods GET,POST,OPTIONS;

 

相关文章:

  • 2021-10-19
  • 2020-01-21
  • 2019-12-05
  • 2021-11-01
  • 2021-11-27
  • 2021-11-27
  • 2021-11-20
  • 2021-11-30
猜你喜欢
  • 2021-11-20
  • 2021-11-27
  • 2020-07-20
  • 2021-04-09
  • 2021-11-27
  • 2021-10-15
  • 2021-08-28
  • 2021-01-10
相关资源
相似解决方案