欢迎光临
我们一直在努力

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;
}

文章来源于互联网:nginx添加svg eot|ttf|woff|woff2|跨域请求

赞(0)
未经允许不得转载:莱卡云 » nginx添加svg eot|ttf|woff|woff2|跨域请求