互联网浏览器字体 ssl

发布于 2025-01-01 15:57:43 字数 3093 浏览 0 评论 0原文

我网站的字体在所有使用 http 的浏览器中都能正常工作。但是,当我更改为 https 时,字体在 IE8 及更低版本中不起作用,但在 ie9 中正常工作。

使用 IE,当我使用 http 输入 .eot 文件的路径时,我可以选择下载该文件,但当我使用 https 时,它说找不到该文件。

我正在使用自行分配的证书。 iis 7.5 .net 4.0、umbraco 4.7.0 cms、客户端依赖框架(我已尝试删除客户端依赖框架,但仍然不起作用)。

<style type="text/css">    
@font-face {
                font-family: 'GGX88UltraLight';
                src: url('/css/type/ggx88_ul-webfont.eot');
                src: url('/css/type/ggx88_ul-webfont.eot?iefix') format('embedded-opentype'),
                     url('/css/type/ggx88_ul-webfont.woff') format('woff'),
                     url('/css/type/ggx88_ul-webfont.ttf') format('truetype'),
                     url('/css/type/ggx88_ul-webfont.svg#webfontU6kiGgEl') format('svg');
                font-weight: normal;
                font-style: normal;
    }
</style>

可能有用的网络配置值

<staticContent>
  <!-- Set expire headers to 30 days for static content-->
  <clientCache cacheControlMode="DisableCache" cacheControlMaxAge="30.00:00:00" />
  <!-- use utf-8 encoding for anything served text/plain or text/html -->
  <remove fileExtension=".css" />
  <mimeMap fileExtension=".css" mimeType="text/css; charset=UTF-8" />
  <remove fileExtension=".js" />
  <mimeMap fileExtension=".js" mimeType="text/javascript; charset=UTF-8" />
  <remove fileExtension=".json" />
  <mimeMap fileExtension=".json" mimeType="application/json; charset=UTF-8" />
  <remove fileExtension=".rss" />
  <mimeMap fileExtension=".rss" mimeType="application/rss+xml; charset=UTF-8" />
  <remove fileExtension=".html" />
  <mimeMap fileExtension=".html" mimeType="text/html; charset=UTF-8" />
  <remove fileExtension=".xml" />
  <mimeMap fileExtension=".xml" mimeType="application/xml; charset=UTF-8" />
  <!-- HTML5 Video mime types-->
  <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
  <mimeMap fileExtension=".m4v" mimeType="video/m4v" />
  <mimeMap fileExtension=".ogg" mimeType="video/ogg" />
  <mimeMap fileExtension=".ogv" mimeType="video/ogg" />
  <mimeMap fileExtension=".webm" mimeType="video/webm" />
  <!-- Remove default IIS mime type for .eot which is application/octet-stream -->
  <remove fileExtension=".eot" />
  <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" /> 
  <mimeMap fileExtension=".otf" mimeType="font/otf" />
  <mimeMap fileExtension=".woff" mimeType="font/x-woff" />
  <mimeMap fileExtension=".crx" mimeType="application/x-chrome-extension" />
  <mimeMap fileExtension=".xpi" mimeType="application/x-xpinstall" />
  <mimeMap fileExtension=".safariextz" mimeType="application/octet-stream" />
</staticContent>
<httpProtocol allowKeepAlive="true">
  <customHeaders>
    <add name="X-UA-Compatible" value="IE=Edge,chrome=1" />
    <add name="Access-Control-Allow-Origin" value="*" />
  </customHeaders>
</httpProtocol>

The fonts for my site are working fine in all browsers using http. However when I change to https the fonts don't work in IE8 and below, works correctly in ie9.

Using IE, when I type the path to the .eot file using http, I get the option to download the file, but when I use https, it says it can't be found.

I'm using a self assigned certificate. iis 7.5 .net 4.0, umbraco 4.7.0 cms, client dependency framework (I have tried with client dependency framework removed, still didn't work).

<style type="text/css">    
@font-face {
                font-family: 'GGX88UltraLight';
                src: url('/css/type/ggx88_ul-webfont.eot');
                src: url('/css/type/ggx88_ul-webfont.eot?iefix') format('embedded-opentype'),
                     url('/css/type/ggx88_ul-webfont.woff') format('woff'),
                     url('/css/type/ggx88_ul-webfont.ttf') format('truetype'),
                     url('/css/type/ggx88_ul-webfont.svg#webfontU6kiGgEl') format('svg');
                font-weight: normal;
                font-style: normal;
    }
</style>

web config values that might be useful

<staticContent>
  <!-- Set expire headers to 30 days for static content-->
  <clientCache cacheControlMode="DisableCache" cacheControlMaxAge="30.00:00:00" />
  <!-- use utf-8 encoding for anything served text/plain or text/html -->
  <remove fileExtension=".css" />
  <mimeMap fileExtension=".css" mimeType="text/css; charset=UTF-8" />
  <remove fileExtension=".js" />
  <mimeMap fileExtension=".js" mimeType="text/javascript; charset=UTF-8" />
  <remove fileExtension=".json" />
  <mimeMap fileExtension=".json" mimeType="application/json; charset=UTF-8" />
  <remove fileExtension=".rss" />
  <mimeMap fileExtension=".rss" mimeType="application/rss+xml; charset=UTF-8" />
  <remove fileExtension=".html" />
  <mimeMap fileExtension=".html" mimeType="text/html; charset=UTF-8" />
  <remove fileExtension=".xml" />
  <mimeMap fileExtension=".xml" mimeType="application/xml; charset=UTF-8" />
  <!-- HTML5 Video mime types-->
  <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
  <mimeMap fileExtension=".m4v" mimeType="video/m4v" />
  <mimeMap fileExtension=".ogg" mimeType="video/ogg" />
  <mimeMap fileExtension=".ogv" mimeType="video/ogg" />
  <mimeMap fileExtension=".webm" mimeType="video/webm" />
  <!-- Remove default IIS mime type for .eot which is application/octet-stream -->
  <remove fileExtension=".eot" />
  <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" /> 
  <mimeMap fileExtension=".otf" mimeType="font/otf" />
  <mimeMap fileExtension=".woff" mimeType="font/x-woff" />
  <mimeMap fileExtension=".crx" mimeType="application/x-chrome-extension" />
  <mimeMap fileExtension=".xpi" mimeType="application/x-xpinstall" />
  <mimeMap fileExtension=".safariextz" mimeType="application/octet-stream" />
</staticContent>
<httpProtocol allowKeepAlive="true">
  <customHeaders>
    <add name="X-UA-Compatible" value="IE=Edge,chrome=1" />
    <add name="Access-Control-Allow-Origin" value="*" />
  </customHeaders>
</httpProtocol>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一张白纸 2025-01-08 15:57:43

我使用 spring-boot 遇到了同样的行为:
我找到的解决方案是

- 隐藏 Pragma 和 Cache-Control 返回给浏览器的标头:

Spring-boot 使用特定的 Cache-Control 和 Pragma HTTP 标头进行响应。

Cache-Control :"no-cache, no-store, max-age=0, must-revalidate"
Pragma :"no-cache"

Internet Explorer(在我的例子中为 IE11)无法加载带有这些标题的字体。
我相信这是一个错误,我们必须应对它。

使用 nginx 代理我们的 spring-boot 应用程序,
我可以克服这个问题,
使用以下 nginx 配置命令向浏览器隐藏该标头:

server {
        listen 443;
        server_name server.dns.name;
        ssl on;
        ssl_certificate /etc/nginx/ssl/server.dns.name.pem;
        ssl_certificate_key /etc/nginx/ssl/server.dns.name.key;

        location / {
            include  /etc/nginx/mime.types;
            rewrite ^/(.*) /$1 break;
            proxy_pass  http://127.0.0.1:8080;
            proxy_read_timeout 90;

            #IE specific tweak for fonts not to be ignored:
            proxy_hide_header Cache-Control;
            proxy_hide_header Pragma; 
            #END IE specific tweak for fonts not to be ignored
        }
}

I faced the same behaviour using spring-boot:
the solution I found was to

- Hide Pragma and Cache-Control returned headers to the browser:

Spring-boot is responding with specific Cache-Control and Pragma HTTP headers.

Cache-Control :"no-cache, no-store, max-age=0, must-revalidate"
Pragma :"no-cache"

Internet explorer (IE11 in my case) is not able to load fonts with those headers.
I believe its a bug and we have to cope with it.

Using nginx to proxy our spring-boot application,
I could overcome the problem ,
hiding that headers to the browser by using the following nginx configuration commands:

server {
        listen 443;
        server_name server.dns.name;
        ssl on;
        ssl_certificate /etc/nginx/ssl/server.dns.name.pem;
        ssl_certificate_key /etc/nginx/ssl/server.dns.name.key;

        location / {
            include  /etc/nginx/mime.types;
            rewrite ^/(.*) /$1 break;
            proxy_pass  http://127.0.0.1:8080;
            proxy_read_timeout 90;

            #IE specific tweak for fonts not to be ignored:
            proxy_hide_header Cache-Control;
            proxy_hide_header Pragma; 
            #END IE specific tweak for fonts not to be ignored
        }
}
白衬杉格子梦 2025-01-08 15:57:43

如果更改 url 源的顺序会怎样?就像将“svg”网址放在第二位..就在“embedded-opentype”之后。

   @font-face {
                font-family: 'GGX88UltraLight';
                src: url('/css/type/ggx88_ul-webfont.eot');
                src: url('/css/type/ggx88_ul-webfont.eot?iefix') format('embedded-opentype'),
                     url('/css/type/ggx88_ul-webfont.svg#webfontU6kiGgEl') format('svg'),
                     url('/css/type/ggx88_ul-webfont.woff') format('woff'),
                     url('/css/type/ggx88_ul-webfont.ttf') format('truetype');
                font-weight: normal;
                font-style: normal;
    }

What if you change the order of the url sources. Like put the "svg" url on second place .. right after "embedded-opentype".

   @font-face {
                font-family: 'GGX88UltraLight';
                src: url('/css/type/ggx88_ul-webfont.eot');
                src: url('/css/type/ggx88_ul-webfont.eot?iefix') format('embedded-opentype'),
                     url('/css/type/ggx88_ul-webfont.svg#webfontU6kiGgEl') format('svg'),
                     url('/css/type/ggx88_ul-webfont.woff') format('woff'),
                     url('/css/type/ggx88_ul-webfont.ttf') format('truetype');
                font-weight: normal;
                font-style: normal;
    }
夜访吸血鬼 2025-01-08 15:57:43

https 站点使用一些 SSL 证书。不管怎样,你必须信任这些。
有关如何手动信任的更多详细信息,请访问 https://serverfault.com/questions/176242/how-to-manually-trust-an-ssl-certificate-to-a-development-server

https sites uses some SSL certificates. How ever you have to place trust on those.
For more details how to put trust manually please visit https://serverfault.com/questions/176242/how-to-manually-trust-an-ssl-certificate-to-a-development-server

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文