Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that Font Awesome is not displayed in Firefox under Apache/Nginx

2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to solve the problem that Font Awesome does not show in Firefox under Apache/Nginx". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn how to solve the problem that Font Awesome is not displayed in Firefox under Apache/Nginx.

1. Nginx server solution

The server uses nginx. To add an access-control-allow-origin field to the header of the response, use the add_header instruction:

Configuration example:

The copy code is as follows:

Location / assets/ {

Gzip_static on

Expires max

Add_header cache-control public

Add_header access-control-allow-origin *

}

Second, apache server solution

Font awesome (firefox cannot display Firefox cannot display) cross domain (cross-domain problem)

The problem

It seems that, for security reasons, firefox simply don't allow you to use by default a font that is not hosted on your domain, not even on your subdomain. The cdn based websites can be also affected in this case.

The solution

After some investigations, i found out the workaround: set an access-control-allow-origin header to the font.

The copy code is as follows:

Header set access-control-allow-origin "*"

Also, if you are using nginx as your webserver you will need to include the code below in your virtual host file:

The copy code is as follows:

Location *\. (eot | otf | ttf | woff) ${

Add_header access-control-allow-origin *

}

At this point, I believe you have a deeper understanding of "Font Awesome under Apache/Nginx does not show how to solve it in Firefox". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report