解决stackoverflow.com网站下cdn.sstatic.net资源加载慢的问题
解决stackoverflow.com网站下cdn.sstatic.net资源加载慢的问题
文档说明:只记录关键地方; 2023-01-29
解决工具: ReplaceGoogleCDN扩展
起因:打开https://stackoverflow.com/tags/socat/hot?filter=all 又出现打开很慢的情况了,一查发现,cdn.sstatic.net 加载静态很慢
排查办法:
dig cdn.sstatic.net
dig sstatic.net
排查结果:cdn.sstatic.net 使用了CloudFlare的AnyCast 技术 (称作泛播或者任意播的技术)
通过启发文档,以及实验验证:发现 sstatic.net 能用,还挺快
自定义一条规则,使用 sstatic.net 替换 cdn.sstatic.net 解决静态资源加载慢的问题
规则如下:
{
"action": {
"redirect": {
"transform": {
"host": "sstatic.net",
"scheme": "https"
}
},
"type": "redirect"
},
"condition": {
"requestDomains": [
"cdn.sstatic.net"
],
"resourceTypes": [
"main_frame",
"sub_frame",
"stylesheet",
"script",
"image",
"font",
"object",
"xmlhttprequest",
"ping",
"csp_report",
"media",
"websocket",
"webtransport",
"webbundle",
"other"
],
"urlFilter": "cdn.sstatic.net"
},
"id": 20019,
"priority": 2
}