Caching same object twice for different browsers
Lars Jørgensen
lajo at kb.dk
Thu Jul 14 09:19:52 CEST 2011
Hi,
Sorry for top-quoting, but stuck with Outlook and fixed settings here at the office.
Anyway, I found out that the web server does not use a Vary-header, so that wasn't the problem. After doing some manual tests and being unable the replicate the problem, I started to look harder at the two dumps below. Then it became pretty obvious.
It seems that Explorer and Firefox requests urls in a different way.
Explorer: /erez4/cache/online_master_arkiv_webbilleder_DIA_
Firefox: /erez4/cache/online%5Fmaster%5Farkiv%5Fwebbilleder%5FDIA
Of course that means diffent objects in the cache since varnish hashes on req.url. Is there a know workaround to this problem?
--
Lars
From: varnish-misc-bounces at varnish-cache.org [mailto:varnish-misc-bounces at varnish-cache.org] On Behalf Of Lars Jørgensen
Sent: Wednesday, July 13, 2011 4:09 PM
To: varnish-misc at varnish-cache.org
Subject: Caching same object twice for different browsers
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/20110714/9c0135ea/attachment-0003.html>
More information about the varnish-misc
mailing list