如何在Varnish中禁用"Transfer-Encoding:chunked"编码?

 qsslidan 发布于 2023-01-15 12:19

使用Varnish 4,我有一组后端,它们响应有效的Content-Length标头而没有Transfer-Encoding标头.

在客户端的第一次点击中,Varnish正在删除Content-Length标题并添加Transfer-Encoding: chunked到响应中,而不是使用这些标头响应客户端.(有趣的是,有效载荷似乎没有任何块 - 它是一个连续的有效载荷).

这会给像Flash视频播放器这样的客户端造成严重问题,这些客户端正试图根据Content-Length标头进行分段大小,带宽等分析.他们的分析失败了,他们不能做多比特流等等.

我尝试过一些半明显的事情,比如:

beresp.do_stream = true

beresp.do_gzip = false

unset req.http.Accept-Encoding

示例后端响应:

HTTP/1.1 200 OK
Cache-Control: public, max-age=600
Content-Type: video/mp4
Date: Tue, 13 May 2014 19:44:35 GMT
Server: Apache
Content-Length: 796618
Connection: keep-alive

样品清漆响应:

HTTP/1.1 200 OK
Server: Apache
Cache-Control: public, max-age=600
Content-Type: video/mp4
Date: Tue, 13 May 2014 23:10:06 GMT
X-Varnish: 2
Age: 0
Transfer-Encoding: chunked
Accept-Ranges: bytes

对象的后续加载包括Content-Length头,只是没有第一加载到缓存中.

VCL:https://gist.github.com/onethumb/e64a405cc579909cace1

varnishlog输出:https://gist.github.com/onethumb/e66a2bc4727a3a5340b6

Varnish Trac:https://www.varnish-cache.org/trac/ticket/1506

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有