nginx配置跨域访问
时间:2015-08-11 11:45:09
收藏:0
阅读:166
前端要在本地测试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;
原文:http://www.cnblogs.com/ctrlzhang/p/4720405.html
评论(0)