Apache, nginx font awesome does not display problem-solving in Firefox _linux

Source: Internet
Author: User
Tags nginx server

First, the Nginx server solves the method

The server is using Nginx, to add the Access-control-allow-origin field to the head of the response, add the method by using the Add_header directive:

Configuration Example:

Copy Code code as follows:

location/assets/{
Gzip_static on;
Expires Max;
Add_header Cache-control public;
Add_header Access-control-allow-origin *;
}

Two, the Apache server solves the method

Font Awesome (Firefox cannot show Firefox cannot be displayed) Cross domain (cross-domain issue)

The problem

It seems that, for the security reasons, Firefox simply don ' t allow your to use by default a font, isn't, hosted on your do Main, not even on your subdomain. The CDN based websites can be also affected in this case.

The solution

After some investigations, I found out of the Workaround:set a access-control-allow-origin header to the font.

Copy Code code as follows:

<filesmatch "\. (Ttf|otf|eot|woff) $ ">
<ifmodule mod_headers.c>
Header set Access-control-allow-origin "*"
</IfModule>
</FilesMatch>

Also, if you are using Nginx as your webserver your'll need to include the code below in your virtual host file:
Copy Code code as follows:

Location ~* \. (Eot|otf|ttf|woff) $ {
Add_header Access-control-allow-origin *;
}

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.