前端要在本地测试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;

 

相关文章:

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