同一个文件, Safari 返回和 Chrome 返回不一致?

2016-03-26 20:11:54 +08:00
 Andy1999

简直 Exciting!

还有为什么部分 css 不能被替换,已经在后端禁用 gzip 了

location /fonts { 
		proxy_pass https://fonts.googleapis.com/;
		proxy_redirect off;
		proxy_set_header Accept-Encoding ''; 
		subs_filter_types text/css text/xml application/x-javascript;
		sub_filter_once off;
		subs_filter fonts.gstatic.com cdn.moefont.com/gstatic;
                }

更加奇怪的是部分能替换,部分不能

https://cdn.moefont.com/fonts/earlyaccess/notosanssc.css 可以

https://cdn.moefont.com/fonts/css?family=Source+Sans+Pro 这个就不行

3255 次点击
所在节点    问与答
29 条回复
ZGLHHH
2016-03-26 20:19:52 +08:00
VmuTargh
2016-03-26 20:20:22 +08:00
你应该说: 简直 Excited! 这才是正确读法←_←
kn007
2016-03-26 20:21:02 +08:00
我这边都有被替换。
chrome 。或许你那边 cache 了?
Andy1999
2016-03-26 20:43:51 +08:00
kn007
2016-03-26 20:54:11 +08:00
@Andy1999 cdn 问题?

IP : 113.107.238.19

Andy1999
2016-03-26 20:57:35 +08:00
@kn007 我擦 看到的内容都不一致
kn007
2016-03-26 20:58:39 +08:00
@Andy1999 就是就是,我觉得会不会你挂 VPN 的原因,解析的 CDN 服务器上的内存 cache 的不对?
你那几台服务器或许需要集体 clean 下,或者对现在错的 ip 所属 clean 。。
Andy1999
2016-03-26 21:05:52 +08:00
@kn007 不行啊 SLB 真的太多了 我挂的是 Surge 我在查查
aofall
2016-03-26 21:07:58 +08:00
访问的地址是可以根据浏览器来判断、加载不同 css 以加载不同格式的字体

https://fonts.googleapis.com/css?family=Kavoon

用 Chrome 访问返回 woff2 格式的字体

IE 访问返回 woff 格式的字体

etc.
kn007
2016-03-26 21:08:18 +08:00
@Andy1999 你查查,有事联系。。

@Livid 一直收不到 @Andy1999 的回复提醒。
Andy1999
2016-03-26 21:14:49 +08:00
@aofall 对,已经发现了这个问题,正在看空 UA 他会返回什么
VmuTargh
2016-03-26 22:40:29 +08:00
noysk_000@WINDOWS-QU992AO MINGW32 ~
$ curl -v https://cdn.moefont.com/fonts/css?family=Source+Sans+Pro
* STATE: INIT => CONNECT handle 0x200482f0; line 1103 (connection #-5000)
* Added connection 0. The cache now contains 1 members
* Trying 119.147.33.20...
* STATE: CONNECT => WAITCONNECT handle 0x200482f0; line 1156 (connection #0)
* Connected to cdn.moefont.com (119.147.33.20) port 443 (#0)
* STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x200482f0; line 1253 (connection #0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /usr/ssl/certs/ca-bundle.crt
CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* STATE: SENDPROTOCONNECT => PROTOCONNECT handle 0x200482f0; line 1267 (connection #0)
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* NPN, negotiated HTTP1.1
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Unknown (67):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: OU=Domain Control Validated; CN=*.moefont.com
* start date: Sep 29 14:43:18 2015 GMT
* expire date: Sep 29 14:43:18 2016 GMT
* subjectAltName: cdn.moefont.com matched
* issuer: C=BE; O=GlobalSign nv-sa; CN=AlphaSSL CA - SHA256 - G2
* SSL certificate verify ok.
* STATE: PROTOCONNECT => DO handle 0x200482f0; line 1288 (connection #0)
> GET /fonts/css?family=Source+Sans+Pro HTTP/1.1
> Host: cdn.moefont.com
> User-Agent: curl/7.47.1
> Accept: */*
>
* STATE: DO => DO_DONE handle 0x200482f0; line 1350 (connection #0)
* STATE: DO_DONE => WAITPERFORM handle 0x200482f0; line 1477 (connection #0)
* STATE: WAITPERFORM => PERFORM handle 0x200482f0; line 1487 (connection #0)
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 200 OK
* Server nnws/1.7.3.6 is not blacklisted
< Server: nnws/1.7.3.6
< Date: Sat, 26 Mar 2016 14:27:38 GMT
< Content-Type: text/css; charset=utf-8
< Content-Length: 274
< Connection: keep-alive
< Cache-Control: private, max-age=86400
< Expires: Sun, 27 Mar 2016 14:27:38 GMT
< Content-Encoding: identity
< Access-Control-Allow-Origin: *
< Timing-Allow-Origin: *
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< Alternate-Protocol: 443:quic,p=1
< Alt-Svc: quic=":443"; ma=2592000; v="31,30,29,28,27,26,25"
< X-Daa-Tunnel: hop_count=1
<
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 400;
src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url( https://fonts.gstatic.com/s/sourcesanspro/v9/ODelI1aHBYDBqgeIAH2zlNzbP97U9sKh0jjxbPbfOKg.ttf) format('truetype');
}
* STATE: PERFORM => DONE handle 0x200482f0; line 1645 (connection #0)
* Curl_done
* Connection #0 to host cdn.moefont.com left intact




Vivaldi 1.0.430.3:


Firefox 43.0:


Firefox 43.0 with Chrome UA:


Firefox 43.0 with Edge UA:


Firefox 43.0 with iPhone3.0 UA:


Firefox 43.0 with Safari UA:
VmuTargh
2016-03-26 22:42:28 +08:00
空 UA:
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 400;
src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url( https://fonts.gstatic.com/s/sourcesanspro/v9/ODelI1aHBYDBqgeIAH2zlNzbP97U9sKh0jjxbPbfOKg.ttf) format('truetype');
}
Andy1999
2016-03-26 22:44:17 +08:00
@VmuTargh 是的,已经做了 UA 判断(≧∇≦)

目前就一个问题了 为什么有些替换得了 有些不行
VmuTargh
2016-03-26 22:45:38 +08:00
@Andy1999 我觉着应该是 CDN 或者谷歌的锅......
konakona
2016-03-26 22:53:15 +08:00
哼,可恶,为什么你屏幕那么大!
VmuTargh
2016-03-26 23:01:57 +08:00
@Andy1999 http://diylighttpd-vtkg.rhcloud.com/gfonts/css?family=Source+Sans+Pro
你丫参数写错了吧
报错信息:
nginx: [emerg] unknown directive "subs_filter" in /var/lib/openshift/xx/app-root/data//nginx/conf/nginx.conf:57
An error occurred executing 'gear start' (exit code: 1)
Error message: CLIENT_ERROR: Failed to execute: 'control start' for /var/lib/openshift/xx/diy
VmuTargh
2016-03-26 23:05:42 +08:00
Andy1999
2016-03-26 23:31:19 +08:00
@VmuTargh 这需要额外的模块啊…
你是怎么替换的 但是如果不用这个,用 Nginx 默认的替换模块只能替换一次
VmuTargh
2016-03-26 23:33:30 +08:00
@Andy1999 Nginx 1.9.12 Mainline
手动编译, --with-http_sub_module

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/266531

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX