search

Home  >  Q&A  >  body text

Qiniu Cloud Storage - Qiniu+Nginx+icon font=No 'Access-Control-Allow-Origin' header error?

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 

Already loaded

    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}

The browser can access the icon font, and the page prompts 403

How to break this?

给我你的怀抱给我你的怀抱2783 days ago1363

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理2017-05-16 17:27:15

    This is because you have set up anti-hotlinking in Qiniu’s space, but the domain name for accessing the css file is not set in the anti-hotlinking function. As a result, the referer of the image accessed from the css file is the domain name of css, which is not in the whitelist of anti-hotlinking. , so it is 403 forbidden.

    reply
    0
  • ringa_lee

    ringa_lee2017-05-16 17:27:15

    Visual inspection also requires the Access-Control-Allow-Methods and Access-Control-Allow-Headers headers

    reply
    0
  • Cancelreply