Google字体的跨域请求警告 [英] Cross-Origin request warning for google fonts

查看:111
本文介绍了Google字体的跨域请求警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网站上使用Google Webfonts。在Chrome的控制台上,我收到以下警告:

I am using Google Webfonts on my website. In the console on Chrome I get the following warning:


Blink正在考虑拒绝不符合规范的跨域Web
字体请求:
http://fonts.gstatic.com/s/raleway/v8/0dTEPzkLWceF7z0koJaX1A。 woff2
请使用Access-Control-Allow-Origin来使这些请求符合
规范。

Blink is considering rejecting non spec-compliant cross-origin web font requests: http://fonts.gstatic.com/s/raleway/v8/0dTEPzkLWceF7z0koJaX1A.woff2. Please use Access-Control-Allow-Origin to make these requests spec-compliant.

检查后请求标头似乎不存在任何访问控制标头:

Upon inspecting the request headers there appears to not be any Access-Control headers present:

Remote Address:109.231.231.219:80
Request URL:http://fonts.gstatic.com/s/raleway/v8/0dTEPzkLWceF7z0koJaX1A.woff2
Request Method:GET
Status Code:304 Not Modified
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,en-GB;q=0.6
Cache-Control:max-age=0
Connection:keep-alive
DNT:1
Host:fonts.gstatic.com
If-Modified-Since:Mon, 04 Aug 2014 17:04:46 GMT
Origin:http://samarkanddesign.com
Referer:http://samarkanddesign.com/
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36
Response Headersview source
Age:369865
Date:Fri, 08 Aug 2014 02:01:39 GMT
Expires:Sat, 08 Aug 2015 02:01:39 GMT
Server:GFE/2.0

我该怎么办?因为我不完全了解CORS,所以谁能解释发生了什么。在firefox和IE中查看该页面时,似乎阻止了字体请求。

What can I do to solve this? Can anyone explain what's going on as I don't fully understand CORS. The page when viewed in firefox and IE seems to block the font request.

要注意的一件事是,我正在公司网络上查看该网站。它可能具有奇怪的设置或代理,剥夺了Access-Control标头。正常连接的任何人都可以验证标头通常存在吗?该页面位于 http://samarkanddesign.com

One thing to note is that I'm viewing the site on my company network. It might have a strange setting or proxy that strips out Access-Control headers. Can anyone one a normal connection verify the headers are usually present? The page is at http://samarkanddesign.com

推荐答案

好吧,很明显Google字体允许跨域访问,否则它们的服务就不会使用很多。

Ok, so clearly Google Fonts allows cross-domain access or their service wouldn't be much use.

对我的特殊问题的解释是,我企业互联网连接上的m。它必须使用某些代理来从Web响应中删除访问控制标头。这会导致浏览器在加载资源时发出警告或失败。

The explanation for my particular problem is that I'm on a corporate internet connection. It must use some proxy that is stripping out access control headers from web responses. This causes the browser to give warnings or failures when loading the resources.

我已经联系IT部门,警告他们有关代理配置错误的问题,希望可以解决此问题。

I've contacted IT warning them about their misconfigured proxy and hopefully this will be fixed.

这篇关于Google字体的跨域请求警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆