错误日志如下:
elk.html:1 Access to Font at 'http://statics.gongstring.com/plugins/font-awesome-4.3.0/fonts/fontawesome-webfont.woff2?v=4.3.0' from origin 'http://192.168.200.104:9027' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.200.104:9027' is therefore not allowed access.
解决办法:
在Nginx中配置如下:
server{ listen 80; server_name statics.gongstring.com; location / { add_header Access-Control-Allow-Origin $http_origin; root /app/statics; index index.html; } }
其中网上有很多解决方法是:
add_header Access-Control-Allow-Origin *;
如果不管用就用
add_header Access-Control-Allow-Origin $http_origin;