解决Nginx跨域访问

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zfy1355/article/details/78558744

在nginx.conf中配置

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'POST,GET,PUT,DELETE,OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since';
add_header 'Access-Control-Allow-Credentials' 'true';

猜你喜欢

转载自blog.csdn.net/zfy1355/article/details/78558744