beresp.cacheable on Varnish 3.

Jeroen Ooms jeroen.ooms at stat.ucla.edu
Tue Oct 18 22:09:28 CEST 2011


I am using varnish among other things to cache a wordpress site. I just
upgraded to Ubuntu 11.10, and thereby also the default varnish is updated
from 2.1. to 2.2. However I'm getting an error now: Unknown variable
'beresp.cacheable'.

Basically the problem is that I want to enforce caching of all content,
except for stuff under /wp-login and /wp-admin. Furthermore it should also
cache HTTP 400 responses. Below the code that I grabbed from somewhere I
don't remember, that did the job in Varnish 2.1. How should I update this
now beresp.cacheable is no longer available?

Thanks,

sub vcl_fetch {
   if (!(req.url ~ "wp-(login|admin)")) {
      unset beresp.http.set-cookie;
      set beresp.ttl = 12h;
      set beresp.cacheable = true;
      set beresp.http.cache-control = "public";
   }
   if ( beresp.status == 400 ) {
      set beresp.ttl = 1h;
      set beresp.cacheable = true;
      set beresp.http.cache-control = "public";
   }
   if (!beresp.cacheable) {
      return (pass);
   }
   if (beresp.http.Set-Cookie) {
      return (pass);
   }
   return (deliver);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20111018/704cb335/attachment-0003.html>


More information about the varnish-misc mailing list