[Varnish] #448: Allow caching with past-date Expires (without cache-control)
Varnish
varnish-bugs at projects.linpro.no
Mon Feb 16 16:12:21 CET 2009
#448: Allow caching with past-date Expires (without cache-control)
----------------------+-----------------------------------------------------
Reporter: stonor | Owner: phk
Type: defect | Status: new
Priority: normal | Milestone:
Component: varnishd | Version: trunk
Severity: normal | Keywords:
----------------------+-----------------------------------------------------
In some cases you want aggressive caching, e.g. if the site is slashdotted
and you want to take as much possible load off the backend. It works
fairly well today be playing with set obj.ttl, but I've faced a case where
it was not possible to set obj.ttl by hand without changing the backend
headers -- and where I really missed the option:
I have the "Expires" header is set to a past-date (to prevent in-browser
caching) and no cache-controls headers. In that case the objects are set
to non-cacheable. Adding a "cache-control" header with a max-age works,
but I want to avoid tampering with the backend in this case.
So: Could it be possible to set handmade obj.ttl on responses with past-
date "Expires" headers (without additional cache related headers)?
First request:
{{{
9 ReqStart c 127.0.0.1 36351 1202324732
9 RxRequest c GET
9 RxURL c /test_varnish
9 RxProtocol c HTTP/1.1
9 RxHeader c Host: localhost:8010
9 RxHeader c User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.9.0.6) Gecko/2009020911 Ubuntu/8.10 (intrepid) Firefox/3.0.6
9 RxHeader c Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
9 RxHeader c Accept-Language: en-us,en;q=0.5
9 RxHeader c Accept-Encoding: gzip,deflate
9 RxHeader c Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
9 RxHeader c Keep-Alive: 300
9 RxHeader c Connection: keep-alive
9 VCL_call c recv
9 VCL_return c lookup
9 VCL_call c hash
9 VCL_return c hash
9 VCL_call c miss
9 VCL_return c fetch
10 BackendOpen b backend_0 127.0.0.1 48693 127.0.0.1 8080
9 Backend c 10 backend_0 backend_0
10 TxRequest b GET
10 TxURL b /test_varnish
10 TxProtocol b HTTP/1.1
10 TxHeader b Host: localhost:8010
10 TxHeader b User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.9.0.6) Gecko/2009020911 Ubuntu/8.10 (intrepid) Firefox/3.0.6
10 TxHeader b Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
10 TxHeader b Accept-Language: en-us,en;q=0.5
10 TxHeader b Accept-Encoding: gzip,deflate
10 TxHeader b Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
10 TxHeader b X-Varnish: 1202324732
10 TxHeader b X-Forwarded-For: 127.0.0.1
10 RxProtocol b HTTP/1.1
10 RxStatus b 200
10 RxResponse b OK
10 RxHeader b Server: Zope/(Zope 2.10.6-final, python 2.4.5,
linux2) ZServer/1.1 Plone/3.1.5.1
10 RxHeader b Date: Mon, 16 Feb 2009 15:08:21 GMT
10 RxHeader b Content-Length: 4
10 RxHeader b Expires: Tue, 27 Jan 2000 15:26:36 GMT
10 RxHeader b Content-Type: text/plain; charset=utf-8
9 ObjProtocol c HTTP/1.1
9 ObjStatus c 200
9 ObjResponse c OK
9 ObjHeader c Server: Zope/(Zope 2.10.6-final, python 2.4.5,
linux2) ZServer/1.1 Plone/3.1.5.1
9 ObjHeader c Date: Mon, 16 Feb 2009 15:08:21 GMT
9 ObjHeader c Expires: Tue, 27 Jan 2000 15:26:36 GMT
9 ObjHeader c Content-Type: text/plain; charset=utf-8
10 BackendReuse b backend_0
9 TTL c 1202324732 RFC 0 1234796901 1234796901 948986796 0 0
9 VCL_call c fetch
9 TTL c 1202324732 VCL 86400 1234796901
9 VCL_return c pass
9 Length c 4
9 VCL_call c deliver
9 VCL_return c deliver
9 TxProtocol c HTTP/1.1
9 TxStatus c 200
9 TxResponse c OK
9 TxHeader c Server: Zope/(Zope 2.10.6-final, python 2.4.5,
linux2) ZServer/1.1 Plone/3.1.5.1
9 TxHeader c Expires: Tue, 27 Jan 2000 15:26:36 GMT
9 TxHeader c Content-Type: text/plain; charset=utf-8
9 TxHeader c Content-Length: 4
9 TxHeader c X-Varnish-Action: FETCH (pass - not cacheable)
9 TxHeader c Date: Mon, 16 Feb 2009 15:08:21 GMT
9 TxHeader c X-Varnish: 1202324732
9 TxHeader c Age: 0
9 TxHeader c Via: 1.1 varnish
9 TxHeader c Connection: keep-alive
9 ReqEnd c 1202324732 1234796901.329282761 1234796901.334547043
0.000193834 0.005165339 0.000098944
}}}
Second request, not cache hit:
{{{
9 ReqStart c 127.0.0.1 36353 1202324733
9 RxRequest c GET
9 RxURL c /test_varnish
9 RxProtocol c HTTP/1.1
9 RxHeader c Host: localhost:8010
9 RxHeader c User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.9.0.6) Gecko/2009020911 Ubuntu/8.10 (intrepid) Firefox/3.0.6
9 RxHeader c Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
9 RxHeader c Accept-Language: en-us,en;q=0.5
9 RxHeader c Accept-Encoding: gzip,deflate
9 RxHeader c Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
9 RxHeader c Keep-Alive: 300
9 RxHeader c Connection: keep-alive
9 VCL_call c recv
9 VCL_return c lookup
9 VCL_call c hash
9 VCL_return c hash
9 HitPass c 1202324732
9 VCL_call c pass
9 VCL_return c pass
9 Backend c 10 backend_0 backend_0
10 TxRequest b GET
10 TxURL b /test_varnish
10 TxProtocol b HTTP/1.1
10 TxHeader b Host: localhost:8010
10 TxHeader b User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.9.0.6) Gecko/2009020911 Ubuntu/8.10 (intrepid) Firefox/3.0.6
10 TxHeader b Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
10 TxHeader b Accept-Language: en-us,en;q=0.5
10 TxHeader b Accept-Encoding: gzip,deflate
10 TxHeader b Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
10 TxHeader b X-Varnish: 1202324733
10 TxHeader b X-Forwarded-For: 127.0.0.1
10 RxProtocol b HTTP/1.1
10 RxStatus b 200
10 RxResponse b OK
10 RxHeader b Server: Zope/(Zope 2.10.6-final, python 2.4.5,
linux2) ZServer/1.1 Plone/3.1.5.1
10 RxHeader b Date: Mon, 16 Feb 2009 15:08:28 GMT
10 RxHeader b Content-Length: 4
10 RxHeader b Expires: Tue, 27 Jan 2000 15:26:36 GMT
10 RxHeader b Content-Type: text/plain; charset=utf-8
9 ObjProtocol c HTTP/1.1
9 ObjStatus c 200
9 ObjResponse c OK
9 ObjHeader c Server: Zope/(Zope 2.10.6-final, python 2.4.5,
linux2) ZServer/1.1 Plone/3.1.5.1
9 ObjHeader c Date: Mon, 16 Feb 2009 15:08:28 GMT
9 ObjHeader c Expires: Tue, 27 Jan 2000 15:26:36 GMT
9 ObjHeader c Content-Type: text/plain; charset=utf-8
10 BackendReuse b backend_0
9 TTL c 1202324733 RFC 0 1234796908 1234796908 948986796 0 0
9 VCL_call c fetch
9 TTL c 1202324733 VCL 86400 1234796909
9 VCL_return c pass
9 Length c 4
9 VCL_call c deliver
9 VCL_return c deliver
9 TxProtocol c HTTP/1.1
9 TxStatus c 200
9 TxResponse c OK
9 TxHeader c Server: Zope/(Zope 2.10.6-final, python 2.4.5,
linux2) ZServer/1.1 Plone/3.1.5.1
9 TxHeader c Expires: Tue, 27 Jan 2000 15:26:36 GMT
9 TxHeader c Content-Type: text/plain; charset=utf-8
9 TxHeader c Content-Length: 4
9 TxHeader c X-Varnish-Action: FETCH (pass - not cacheable)
9 TxHeader c Date: Mon, 16 Feb 2009 15:08:28 GMT
9 TxHeader c X-Varnish: 1202324733
9 TxHeader c Age: 0
9 TxHeader c Via: 1.1 varnish
9 TxHeader c Connection: keep-alive
9 ReqEnd c 1202324733 1234796908.797154903 1234796908.800419807
0.000104427 0.003054142 0.000210762
}}}
--
Ticket URL: <http://varnish.projects.linpro.no/ticket/448>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator
More information about the varnish-bugs
mailing list