linux apache nginx 服务配置跨域

Header set Access-Control-Allow-Origin "http://www.jl.com" apache配置

在nginx.conf中配置
http {
......
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
......
}
这样就可以实现GET,POST,OPTIONS的跨域请求的支持
也可以 add_header Access-Control-Allow-Origin http://test.51testing.com; --指定允许的url;

posted @ 2017-01-04 16:13  王君山山  阅读(116)  评论(0编辑  收藏  举报