nginx 图片,js,css等文件允许跨域

 

 

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
   #允许跨域请求
    add_header Access-Control-Allow-Origin '*';
    add_header Access-Control-Allow-Headers X-Requested-With;
    add_header Access-Control-Allow-Methods GET,POST,OPTIONS;

    expires 30d;
    access_log off;
  }

 

posted @ 2019-04-30 11:36  一个人的孤独自白  阅读(1470)  评论(0编辑  收藏  举报