Cloud CDN节点对压缩资源的测试
Cloud CDN节点对压缩资源的测试
请求同一cache-id的情况下,缓存的副本由首次请求是否携带压缩头决定。如果带,则后续即使禁用压缩,下载资源也是压缩后的;如果不带,则始终是压缩前资源。
前提条件:
- 多次携带压缩头访问,使其资源命中;
- 源站启用gzip。
测试:
通过curl测试禁用压缩头时,请求到的仍是压缩资源。
wanggaoli@WangGaoli ~ $ curl -vo update.txt 'http://cdn1-20000048-us.eggtartgame.com/1.5.2/Android/9/update.txt' -x '34.160.153.13:80' -H 'Accept-Encoding: identity'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 34.160.153.13:80...
* Connected to 34.160.153.13 (34.160.153.13) port 80 (#0)
> GET http://cdn1-20000048-us.eggtartgame.com/1.5.2/Android/9/update.txt HTTP/1.1
> Host: cdn1-20000048-us.eggtartgame.com
> User-Agent: curl/7.79.1
> Accept: */*
> Proxy-Connection: Keep-Alive
> Accept-Encoding: identity
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: nginx/1.6.3
< Content-Encoding: gzip
< Via: 1.1 google
< Date: Fri, 03 Feb 2023 03:03:38 GMT
< Cache-Control: public,max-age=1800
< Last-Modified: Thu, 12 Jan 2023 07:00:43 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 107725
< Age: 214
< cdn_cache_id: NRT-cf0517a3
< cdn_cache_status: hit
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: GET, POST, OPTIONS
< Access-Control-Allow-Headers: DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
<
{ [13325 bytes data]
100 105k 100 105k 0 0 129k 0 --:--:-- --:--:-- --:--:-- 131k
* Connection #0 to host 34.160.153.13 left intact
wanggaoli@WangGaoli ~ $ md5 update.txt
MD5 (update.txt) = 5993f29940961dbdb609e82f5c700b5f
wget得到的也是压缩资源
wanggaoli@WangGaoli ~ $ wget http://cdn1-20000048-us.eggtartgame.com/1.5.2/Android/9/update.txt
--2023-02-03 11:09:57-- http://cdn1-20000048-us.eggtartgame.com/1.5.2/Android/9/update.txt
正在解析主机 cdn1-20000048-us.eggtartgame.com (cdn1-20000048-us.eggtartgame.com)... 34.160.153.13
正在连接 cdn1-20000048-us.eggtartgame.com (cdn1-20000048-us.eggtartgame.com)|34.160.153.13|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:107725 (105K) [text/plain]
正在保存至: “update.txt.2”
update.txt.2 100%[=========================================================================================>] 105.20K 218KB/s 用时 0.5s
2023-02-03 11:09:58 (218 KB/s) - 已保存 “update.txt.2” [107725/107725])
wanggaoli@WangGaoli ~ $ md5 update.txt.2
MD5 (update.txt.2) = 5993f29940961dbdb609e82f5c700b5f
文章目录
关闭