[Varnish] #1217: compress with ttl=0 returns invalid content-length
Varnish
varnish-bugs at varnish-cache.org
Thu Oct 18 12:24:30 CEST 2012
#1217: compress with ttl=0 returns invalid content-length
-----------------------+----------------------
Reporter: prymitive | Type: defect
Status: new | Priority: normal
Milestone: | Component: varnishd
Version: 3.0.3 | Severity: normal
Keywords: |
-----------------------+----------------------
I have val as below.
{{{
sub vcl_fetch {
if (beresp.http.x-cachable == "0") {
set beresp.ttl = 0s;
}
if (beresp.http.content-type ~ "(text|javascript|json)") {
set beresp.do_gzip = true;
}
}
sub vcl_deliver {
if (obj.hits > 0) {
set resp.http.X-Cache = "HIT";
} else {
set resp.http.X-Cache = "MISS";
}
}
}}}
My backend sends "X-Cachable: 0" header for some apps.
First I get an answer without Content-Length header:
{{{
curl -H "Accept-Encoding: gzip" -I
http://my.app.com/static/js/jquery.qtip.js
HTTP/1.1 200 OK
Content-Type: application/javascript
Content-Encoding: gzip
X-Cache: MISS
}}}
After that varnish starts to repond with Content-Length header set to size
of uncompressed jquery.qtip.js
{{{
curl -H "Accept-Encoding: gzip" -I
http://my.app.com/static/js/jquery.qtip.js
HTTP/1.1 200 OK
Content-Type: application/javascript
Content-Length: 97197
Content-Encoding: gzip
X-Cache: MISS
}}}
Without valid encoding Content-Length is the same
{{{
curl -H "Accept-Encoding: xgzip" -I
http://my.app.com/static/js/jquery.qtip.js
HTTP/1.1 200 OK
Content-Type: application/javascript
Content-Length: 97197
X-Cache: MISS
}}}
This only happens with '''set beresp.ttl = 0s''', when I don't disable
caching with backend headers is works fine.
--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1217>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator
More information about the varnish-bugs
mailing list