Nginx中gzip和Content-Length

今天客户端发现下载文件进度条无法显示,开发人员是根据Content-Length来获取文件大小的。我们有两台服务器对外提供文件下载,其中一台是正常的。比较写的nginx模块这一部分程序完全一致,仔细检查包头信息,发现两个包头中不一致的部分:


引用

HTTP/1.1 200 OK
Server: nginx/0.7.65
Date: Tue, 16 Nov 2010 03:39:28 GMT
Content-Type: text/plain
Connection: keep-alive
Content-Length: 333570
Length: 333570
Content-Range: bytes 0-333569/333570



引用

HTTP/1.1 200 OK
Server: nginx/0.7.65
Date: Tue, 16 Nov 2010 03:42:11 GMT
Content-Type: text/plain
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Length: 68020
Content-Range: bytes 0-68019/68020
Content-Encoding: gzip


原来是因为一天修改了其中一台服务器的配置,打开了gzip后Content-Length字段就没有了。

猜你喜欢

转载自ycsk.iteye.com/blog/812607