即使整个pipe道被压缩,清漆3仍然执行gunzip

我正在重构我的Varnish VCL,并不知道这一件事情。

Varnish 3.0本身支持gzip内容,它本质上似乎是正确的。 另请参阅: https : //stackoverflow.com/a/12962493/35434

然而,根据varnishlog,Varnish仍然执行gunzip步骤,即使客户端请求gzip内容,后端响应gzip内容。 根据Varnish文档,Varnish默认为do_gzip = true,并且还存储压缩的caching对象。 那么,gunzip为什么呢?

这里是相关的日志条目:

11 RxURL c /javascripts/general.js 11 RxHeader c Accept-Encoding: deflate, gzip 11 VCL_call c fetch 13 TxHeader b Accept-Encoding: gzip 13 RxHeader b Content-Encoding: gzip 13 RxHeader b Content-Type: application/javascript 11 Gzip cu F - 1554 4476 80 80 12365 11 VCL_call c deliver 11 TxHeader c Content-Encoding: gzip 

如您所见,整个pipe道支持gzip,但varnish在vcl_fetch期间执行gunzip。 我假设它存储压缩的对象,正如你可以看到它传递压缩以及。

在这个请求之后,varnishstat显示发生了gunzip操作:

 $ varnishstat -1 | grep zip n_gzip 0 0.00 Gzip operations n_gunzip 1 0.00 Gunzip operations 

注意:我的VCL根本没有 gzipconfiguration,也没有对对象的任何内容做任何事情。 我依靠明智的默认,因此我没有显示VCL。

枪支操作相对较轻,但我仍然想知道为什么,并可能阻止几十万的操作。

你可以把这个设置到你的vcl_fetch()部分

 set beresp.do_gunzip = false; 

这应该停止清漆做gzip。