静态资源跨域解决方案
生活随笔
收集整理的這篇文章主要介紹了
静态资源跨域解决方案
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Access to font at 'http://static.xxx.com/css/element-ui/fonts/element-icons.woff' from origin 'http://lw.xxx.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
這是出現問題的現象
nginx靜態資源允許跨域訪問
在server模塊中添加配置:
add_header ‘Access-Control-Allow-Origin' ‘*'; server {listen 80;add_header 'Access-Control-Allow-Origin' '*';location /Roboto/ {root /home/images;autoindex on;}}通過以上方法配置完后,再次跨域訪問靜態資源就沒有問題了
微信掃一掃:關注我個人訂閱號“猿小飛”,更多精彩文章在這里及時發布:?
總結
以上是生活随笔為你收集整理的静态资源跨域解决方案的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux环境下中文乱码问题
- 下一篇: 彻底解决win10自动下载更新的问题