Nginx允许跨域访问的配置问题


跨域问题:

has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://dev2.lystrong.cn' is therefore not allowed access.


为跨域访问问题,可以在静态资源服务器A 配置允许跨域请求,nginx在配置中对应的location下添加上如下的设置:

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';


重启nginx  


鼎云博客
  • 最新评论
  • 总共0条评论