[Varnish] #1506: Backend replies with 'Content-Length' but varnish 4.0 discards and replies with 'Transfer-Encoding: chunked'
Varnish
varnish-bugs at varnish-cache.org
Wed May 14 21:48:25 CEST 2014
#1506: Backend replies with 'Content-Length' but varnish 4.0 discards and replies
with 'Transfer-Encoding: chunked'
---------------------------------+----------------------
Reporter: DonMacAskill | Type: defect
Status: new | Priority: normal
Milestone: Varnish 4.0 release | Component: build
Version: 4.0.0 | Severity: critical
Keywords: |
---------------------------------+----------------------
Nils Goroll suggested I open this ticket, so here goes. Using Varnish 4,
I have a set of backends that're responding with a valid ''Content-
Length'' header and no ''Transfer-Encoding'' header.
On the first hit from a client, rather than responding to the client with
those headers, Varnish is dropping the ''Content-Length'' header and
adding ''Transfer-Encoding: chunked'' to the response. (Interestingly, the
payload doesn't appear to have any chunks in it - it's one contiguous
payload).
This causes serious problems for clients like Flash video players that are
trying to do segment-size, bandwidth, etc analysis based on the ''Content-
Length'' header. Their analysis fails, and they can't do things like
multi-bitrate streaming, etc.
I've tried a number of semi-obvious things like:
* beresp.do_stream = true/false
* beresp.do_gzip = false
* beresp.do_esi = false
* unset req.http.Accept-Encoding
Sample backend response:
{{{
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
}}}
Sample varnish response:
{{{
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
}}}
Subsequent loads of the object do including the Content-Length header,
just not the first load into cache.
VCL: https://gist.github.com/onethumb/e64a405cc579909cace1
varnishlog output: https://gist.github.com/onethumb/e66a2bc4727a3a5340b6
Stackoverflow discussion: http://stackoverflow.com/questions/23643233
/how-do-i-disable-transfer-encoding-chunked-encoding-in-varnish
--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1506>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator
More information about the varnish-bugs
mailing list