nginx cdn的 ttf文件 跨域请求配置

如题,跨域访问cdn上的ttf、woff资源失败

nginx vhost配置相关代码

    server {
        listen       80;
        server_name  www.favfor.me favfor.me;
        root         xxxxxxxx;
        index        xxx.xxx;

        access_log  /var/log/nginx/favf/favf.access.log;
        error_log   /var/log/nginx/favf/favf.error.log;
        
        location ~* \.(eot|ttf|woff|svg|otf)$ {
            add_header Access-Control-Allow-Origin 'http://favfor.me';
            add_header Access-Control-Allow-Headers X-Requested-With;
            add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
            try_files $uri $uri/ =404;
        }
        
        location /api/ {
            proxy_pass xxxxxx;
        }
        
        
        location / {
            try_files $uri $uri/ /index.html;
        }

}

链接

http://static.ifrench.cn/dist...

浏览器资源

图片描述

请问为什么会资源加载失败?多谢了。

阅读 3.5k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题