在nginx.conf里找到http,增加如下配置:
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Credentials 'true' ;
add_header Access-Control-Allow-Methods 'GET,POST,PUT,DELETE,OPTIONS' ;
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
来源:oschina
链接:https://my.oschina.net/u/3625745/blog/3193634