Apologies, the varnish I am now running is not version 2.2 but version 3. <div><br><br><div class="gmail_quote">On Tue, Oct 18, 2011 at 1:09 PM, Jeroen Ooms <span dir="ltr"><<a href="mailto:jeroen.ooms@stat.ucla.edu">jeroen.ooms@stat.ucla.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">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'.<div>
<br></div><div>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?</div>
<div><br></div><div>Thanks,</div><div><br></div><div>sub vcl_fetch {</div><div><div><div> if (!(req.url ~ "wp-(login|admin)")) {</div><div> unset beresp.http.set-cookie;</div><div> set beresp.ttl = 12h; </div>
<div> set beresp.cacheable = true; </div><div> set beresp.http.cache-control = "public";</div><div> }<span style="white-space:pre-wrap"> </span> </div><div> if ( beresp.status == 400 ) {</div>
<div> set beresp.ttl = 1h;</div><div> set beresp.cacheable = true; </div><div> set beresp.http.cache-control = "public";<span style="white-space:pre-wrap"> </span></div><div> }<span style="white-space:pre-wrap"> </span></div>
<div> if (!beresp.cacheable) {</div><div> return (pass);</div><div> }</div><div> if (beresp.http.Set-Cookie) {</div><div> return (pass);</div><div> }</div><div> return (deliver);</div><div>}</div></div>
</div>
</blockquote></div><br></div>