Hello! 欢迎来到NV资源网!

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


站长 2021-11-10 722

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

location ~* \.(eot|ttf|woff|woff2|svg)$ {

add_header AccessControlAllowOrigin *;

add_header AccessControlAllowHeaders XRequestedWith;

add_header AccessControlAllowMethods GET,POST,OPTIONS;

}

暂无评论

发表评论