Nginx cross-domain access to fonts

Source: Internet
Author: User

Today suddenly encountered a problem, the site with the primary domain name, and then its resource file is also configured with a res two domain name, resulting in CSS style reference font style error

Cross-origin requests have been intercepted: the same origin policy prohibits reading remote resources located in http://res.******/fontawesome-webfont.woff2?v=4.5.0. (Reason: CORS header is missing ' Access-control-allow-origin ').



workaround, in res level two domain name nginx.conf plus

Location ~* \. (EOT|TTF|WOFF|SVG|OTF) $ {
Add_header Access-control-allow-origin * or domain name;
Add_header access-control-allow-headers X-requested-with;
Add_header Access-control-allow-methods get,post,options;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.