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

Caunter, Stefan scaunter at topscms.com
Mon Jul 12 16:36:42 CEST 2010


>My backend caching server blindly delivers content without inspecting it.
>This specific page unfortunately comes from a Microsoft IIS ASP server before beign stored in the "cache server".
 
>and none of "Connection:", "Content-Length:" or "Transfer-Encoding"
 
>Yep. But Varnish has to be a bit more tolerant regarding servers deficiencies. Right? 

Microsft IIS sends these headers, our stack is IIS7 to varnish. Something is stripping headers, see varnishlog output below

316 TxHeader     c Content-Type: text/xml; charset=utf-8
  316 TxHeader     c Content-Encoding: gzip
  316 TxHeader     c Vary: Accept-Encoding
  316 TxHeader     c Server: Microsoft-IIS/7.0
  316 TxHeader     c X-Powered-By: ASP.NET
  316 TxHeader     c WS: 2-5
  316 TxHeader     c X-TOPS-CacheReason: Speed
  316 TxHeader     c cache-control: max-age = 300
  316 TxHeader     c Content-Length: 3341
  316 TxHeader     c Date: Mon, 12 Jul 2010 14:33:07 GMT
  316 TxHeader     c X-Varnish: 788805734 788768049
  316 TxHeader     c Age: 177
  316 TxHeader     c Via: 1.1 varnish
  316 TxHeader     c Connection: keep-alive
  316 TxHeader     c X-Cache-Svr: topsvarnish2
  316 TxHeader     c X-Cache: HIT
  316 TxHeader     c X-Cache-Hits: 4044

Stefan Caunter :: Senior Systems Administrator :: TOPS
e: scaunter at topscms.com  ::  m: (416) 561-4871
www.thestar.com www.topscms.com

2010/7/12 Poul-Henning Kamp <phk at phk.freebsd.dk>
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'm facing a little problem with my ac=
>tual varnish config.</div><div>Currently, Varnish have only one backend (it=
>'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 "Content-Length: 0" for it before sending it =
>back to Firefox.</div><div><br></div><div>Inside the cache, this URL has no=
> "Content-Length" header as you can see:</div><div><br></div>
><div>1) CACHE BACKEND ---> 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 ----> 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 "Varnish" to always compute the "Content-Len=
>gth" if it'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.



-- 
Regards
Zabrane




More information about the varnish-misc mailing list