Hello! 欢迎来到盒子萌!

nginx添加svg eot|ttf|woff|woff2|跨域请求


如果没有设置跨域请求的情况下,会出现错误
xxxx has been blocked by CORS policy: No 'Access-Control-Allow-Origin' head...
所以需要再Nginx配置上加个主机头,宝塔的话可以再伪静态上添加,自己经常折腾记录下代码

location ~* \.(eot|ttf|woff|woff2|svg)$ {
    add_header Access-Control-Allow-Origin *;
    add_header Access-Control-Allow-Headers X-Requested-With;
    add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
}

暂无评论

发表评论

相关阅读