Qiniu Cloud Storage – Qiniu+Nginx+icon font=Kein Header-Fehler „Access-Control-Allow-Origin'?
给我你的怀抱
给我你的怀抱 2017-05-16 17:25:15
0
2
1331
Font from origin 'http://img.***.com' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://***.com' is therefore not allowed access. The response had HTTP status code 403. (index):1
GET http://img.***.com/wp-content/themes/someone-v2/fonts/fontawesome-webfont.woff 

Bereits geladen

    location ~* \.(eot|otf|ttf|woff|svg)$ {
        add_header Access-Control-Allow-Origin *;
    }

font-awesome.min.css:

@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot');src:url('../fonts/fontawesome-webfont.eot') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff') format('woff'),url('../fonts/fontawesome-webfont.ttf') format('truetype'),url('../fonts/fontawesome-webfont.svg') format('svg');font-weight:normal;font-style:normal}

Der Browser kann auf die Symbolschriftart zugreifen und die Seite meldet 403

Wie kann man das durchbrechen?

给我你的怀抱
给我你的怀抱

Antworte allen(2)
大家讲道理

这个是因为你在七牛的空间中设置了防盗链,但是防盗链中没有设置访问css文件的域名,导致从css文件中访问到的图片的referer是css的域名,不在防盗链的白名单中,所以被403 forbidden了。

左手右手慢动作

目测还要提供Access-Control-Allow-Methods和Access-Control-Allow-Headers头

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage