nginx font css cross domain problem

Cross-Origin Request Intercepted: The Same Origin Policy prohibits reading the remote resource at http://res.******/fontawesome-webfont.woff2?v=4.5.0. (Cause: CORS header missing 'Access-Control-Allow-Origin').


Because I have configured a PC-side access domain name and a mobile-side access domain name, because the mobile css style accesses the PC-side domain name, the different domain names will lead to font cross-domain problems, as shown below


Solution 1, add in nginx.conf of www.wendao.net

    location ~* \.(eot|ttf|woff|svg|otf)$ {
                        add_header Access-Control-Allow-Origin *或域名;
                        add_header Access-Control-Allow-Headers X-Requested-With;
                        add_header Access-Control-Allow-Methods GET,POST,OPTIONS;

                }


Solution 2, or modify the same domain name

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326736130&siteId=291194637