Caching same object twice for different browsers

Lars Jørgensen lajo at kb.dk
Wed Jul 13 16:09:16 CEST 2011


Hi,

I believe this has been touched upon before, but I can't seem to find anything useful about it. I have discovered that our Varnish caches the same object twice; once for MSIE and once for Firefox. This is from varnishlog:

First Internet Explorer:

  20 RxRequest    c GET
   20 RxURL        c /erez4/cache/online_master_arkiv_webbilleder_DIA_kalender_Koncerter_diaens_mortenfranklarsen_tif_331510ad02b81dd2.jpg
   20 RxProtocol   c HTTP/1.1
   20 RxHeader     c Accept: text/html, application/xhtml+xml, */*
   20 RxHeader     c Accept-Language: da-DK
   20 RxHeader     c User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
   20 RxHeader     c Accept-Encoding: gzip, deflate
   20 RxHeader     c Host: www.kb.dk
   20 RxHeader     c Connection: Keep-Alive
   20 RxHeader     c Cache-Control: no-cache
   20 RxHeader     c Cookie: __utma=52637486.1667608039.1302159744.xxxxxxxxxx.1310564597.16; __utmz=xxxxxxxx.1307533937.4.2.utmccn=(referral)|utmcsr=intranet.kb.dk|utmcct=/ATO/Sider/Genveje.aspx|utmcmd=referral; __utmb=xxxxxx
   20 VCL_call     c recv lookup
   20 VCL_call     c hash
   20 Hash         c /erez4/cache/online_master_arkiv_webbilleder_DIA_kalender_Koncerter_diaens_mortenfranklarsen_tif_331510ad02b81dd2.jpg
   20 Hash         c www.kb.dk
   20 VCL_return   c hash
   20 Hit          c 1414499195
   20 VCL_call     c hit deliver
   20 VCL_call     c deliver deliver

And then Firefox:

   12 RxRequest    c GET
   12 RxURL        c /erez4/cache/online%5Fmaster%5Farkiv%5Fwebbilleder%5FDIA%5Fkalender%5FKoncerter%5Fdiaens%5Fmortenfranklarsen%5Ftif%5F331510ad02b81dd2.jpg
   12 RxProtocol   c HTTP/1.1
   12 RxHeader     c Host: www.kb.dk
   12 RxHeader     c User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.0
   12 RxHeader     c Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
   12 RxHeader     c Accept-Language: da,en-us;q=0.7,en;q=0.3
   12 RxHeader     c Accept-Encoding: gzip, deflate
   12 RxHeader     c Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
   12 RxHeader     c Connection: keep-alive
   12 RxHeader     c Cookie: __switchTo5x=46; __unam=627126b-xxxxxxxxxx-90edcb2-3; __utma=52637486.497784643.xxxxxxxxxx310565486.1310565486.1; __utmb=52xxxx86; __utmc=52xxx86; __utmz=52637486.xxxxxxxxxxx.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
   12 RxHeader     c If-Modified-Since: Wed, 13 Jul 2011 11:49:07 GMT
   12 RxHeader     c Cache-Control: max-age=0
   12 VCL_call     c recv lookup
   12 VCL_call     c hash
   12 Hash         c /erez4/cache/online%5Fmaster%5Farkiv%5Fwebbilleder%5FDIA%5Fkalender%5FKoncerter%5Fdiaens%5Fmortenfranklarsen%5Ftif%5F331510ad02b81dd2.jpg
   12 Hash         c www.kb.dk
   12 VCL_return   c hash
   12 Hit          c 1415348861
   12 VCL_call     c hit deliver
   12 VCL_call     c deliver deliver

Don't worry about the cookies, they are all stripped before going to lookup. As you can see from the lines with "Hit", the two requests for the same object hits two different objects in the cache.

I suspect I need to normalize some of the request headers, but which of them and how?


--
Lars
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110713/757fab69/attachment-0003.html>


More information about the varnish-misc mailing list