nginx设置跨域

localtion 地址。。。{

add_header Access-Control-Allow-Origin * ;

add_header Access-Control-Allow-Credentials true;

add_header Access-Control-Allow-Methods 'GET,POST,OPTIONS';

add_header Access-Control-Allow-Headers 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With';

add_header Content-Type "application/octet-stream";

}


如果没有生效可能是你在header中放入了其他参数

add_header Access-Control-Allow-Headers 继续在里面添加你请求的参数名就好了。