Varnish computes Content-Length and set it to 0 for one of my URL!

Poul-Henning Kamp phk at phk.freebsd.dk
Mon Jul 12 15:36:42 CEST 2010


In message <AANLkTilyL-KO-EbuGBveEMgzsvKyOySM3c_c7Oc3MrtK at mail.gmail.com>, zabr
ane Mikael writes:

Can you please open a ticket on this ?

I need to read the RFC to find out if this is actually a bug, but it
is certainly not conventional of your backend to send HTTP/1.1 and
none of "Connection:", "Content-Length:" or "Transfer-Encoding"

Poul-Henning

>--===============8364418252999650435==
>Content-Type: multipart/alternative; boundary=0015174be612c79937048b2e98c0
>
>--0015174be612c79937048b2e98c0
>Content-Type: text/plain; charset=ISO-8859-1
>
>Hi list,
>
>I'm facing a little problem with my actual varnish config.
>Currently, Varnish have only one backend (it's a caching server).
>
>When trying to get a specific URL from the cache through Varnish, it always
>set the header "Content-Length: 0" for it before sending it back to Firefox.
>
>Inside the cache, this URL has no "Content-Length" header as you can see:
>
>1) CACHE BACKEND ---> VARNISH
>-----------------------------------------------------
>HTTP/1.1 200 OK
>Date: Tue, 15 Jun 2010 09:18:29 GMT
>Content-Type: text/html; charset=UTF-8
>X-Powered-By: ASP.NET
>Set-Cookie: jsessionid=XXXXXXXXXXXXXXXXXXX; path=/
>
>[payload]
>
>
>2) VARNISH ----> FIREFOX
>-----------------------------------------
>Content-Type text/html; charset=UTF-8
>X-Powered-By ASP.NET
>Set-Cookie jsessionid=XXXXXXXXXXXXXXXXXXX; path=/
>Content-Length 0
>Date Mon, 12 Jul 2010 10:11:06 GMT
>X-Varnish 353742751
>Age 0
>Via 1.1 varnish
>
>[payload]
>
>
>How can I tell "Varnish" to always compute the "Content-Length" if it's not
>specified (in the headers response from the cache)?
>
>Help appreciated guys!!!
>
>N.B: getting this URL directly from the cache (i.e without using Varnish)
>works perfectly.
>
>-- 
>Regards
>Zab
>
>--0015174be612c79937048b2e98c0
>Content-Type: text/html; charset=ISO-8859-1
>Content-Transfer-Encoding: quoted-printable
>
>Hi list,<div><br></div><div><div>I&#39;m facing a little problem with my ac=
>tual varnish config.</div><div>Currently, Varnish have only one backend (it=
>&#39;s a caching server).</div><div><br></div><div>When trying to get a spe=
>cific URL from the cache through Varnish, it always</div>
><div>set the header &quot;Content-Length: 0&quot; for it before sending it =
>back to Firefox.</div><div><br></div><div>Inside the cache, this URL has no=
> &quot;Content-Length&quot; header as you can see:</div><div><br></div>
><div>1) CACHE BACKEND ---&gt; VARNISH</div><div>---------------------------=
>--------------------------</div><div>HTTP/1.1 200 OK</div><div>Date: Tue, 1=
>5 Jun 2010 09:18:29 GMT</div><div>Content-Type: text/html; charset=3DUTF-8<=
>/div>
><div>X-Powered-By: <a href=3D"http://ASP.NET">ASP.NET</a></div><div>Set-Coo=
>kie: jsessionid=3DXXXXXXXXXXXXXXXXXXX; path=3D/</div><div><br></div><div>[p=
>ayload]</div><div><br></div><div><br></div><div>2) VARNISH ----&gt; FIREFOX=
></div>
><div>-----------------------------------------</div><div><div>Content-Type<=
>span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>text/html; =
>charset=3DUTF-8</div><div>X-Powered-By<span class=3D"Apple-tab-span" style=
>=3D"white-space:pre">	</span><a href=3D"http://ASP.NET">ASP.NET</a></div>
><div>Set-Cookie<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</=
>span>jsessionid=3DXXXXXXXXXXXXXXXXXXX; path=3D/</div><div>Content-Length<sp=
>an class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0</div><div>D=
>ate<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>Mon, 12=
> Jul 2010 10:11:06 GMT</div>
><div>X-Varnish<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</s=
>pan>353742751</div><div>Age<span class=3D"Apple-tab-span" style=3D"white-sp=
>ace:pre">	</span>0</div><div>Via<span class=3D"Apple-tab-span" style=3D"whi=
>te-space:pre">	</span>1.1 varnish</div>
></div><div><br></div><div>[payload]</div><div><br></div><div><br></div><div=
>>How can I tell &quot;Varnish&quot; to always compute the &quot;Content-Len=
>gth&quot; if it&#39;s not specified (in the headers response from the cache=
>)?</div>
><div><br></div>Help appreciated guys!!!</div><div><br></div><div>N.B: getti=
>ng this URL directly from the cache (i.e without using Varnish) works perfe=
>ctly.</div><div><br>-- <br>Regards<br>Zab<br>
></div>
>
>--0015174be612c79937048b2e98c0--
>
>
>--===============8364418252999650435==
>Content-Type: text/plain; charset="us-ascii"
>MIME-Version: 1.0
>Content-Transfer-Encoding: 7bit
>Content-Disposition: inline
>
>_______________________________________________
>varnish-misc mailing list
>varnish-misc at varnish-cache.org
>http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
>--===============8364418252999650435==--
>

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



More information about the varnish-misc mailing list