obj.cacheable vs expires headers?

Luc Stroobant lstroobant at gmail.com
Mon Feb 8 21:24:52 CET 2010


Antoni Villalonga wrote:

> It's seems to be correct. Be careful with cacheable and ttl=0 answers.
> Some simple debuging:
> sub vcl_fetch {
> 	# Varnish determined the object was not cacheable
> 	if (!obj.cacheable) {
> 		set obj.http.X-Cacheable = "No";
> 	} elsif (obj.ttl > 0s) {
> 		set obj.http.X-Cacheable = "Yes";
> 	} else {
> 		set obj.http.X-Cacheable = "Yes: ttl=0";
> 	}
> 	[...]
> }

Thanks for your reply. I enabled the extra debugging on a test-instance, 
like you proposed.
obj.ttl seems to be zero indeed, but I still don't get how his would 
make the request cacheable. At least it's not the behaviour one would 
Secondly: I also thought that Varnish never caches requests with a 
Set-cookie header?
Or is it just the header that causes problems with intermediate proxies 
between our server and the users (and/or browser cache of the clients)?

Request sent through Varnish:
HTTP/1.1 200 OK
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.2.12
Set-Cookie: SESSbc5f9ce1c97eee1824d1ab670ce3057b14; expires=Wed, 03-Mar-
2010 23:24:42 GMT; path=/; domain=removed
Last-Modified: Mon, 08 Feb 2010 19:49:49 GMT
ETag: "8060981009417cf0496649018d6535fa"
Content-Encoding: gzip
Content-Type: text/html; charset=utf-8
Content-Length: 12955
X-Cacheable: Yes: ttl=0
cache-control: max-age = 900
Date: Mon, 08 Feb 2010 19:51:22 GMT
X-Varnish: 1349734797
Via: 1.1 varnish
Connection: close
age: 0

Direct request:
HTTP/1.1 200 OK
Date: Mon, 08 Feb 2010 19:53:56 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.2.12
Set-Cookie: SESSbc5f9ce1c97eee1824d1ab670ebj735pffubr1e86; expires=Wed, 
03-Mar-2010 23:27:16 GMT; path=/; domain=removed
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Mon, 08 Feb 2010 19:53:56 GMT
Cache-Control: store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0
Connection: close
Content-Type: text/html; charset=utf-8

If this is wanted behaviour, I would propose to add a warning on 
The config can cause serious privacy problems and other weird things on 
sites with logged in users.


More information about the varnish-misc mailing list