Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Misc

beresp.cacheable on Varnish 3.

 

 

Varnish misc RSS feed   Index | Next | Previous | View Threaded


jeroen.ooms at stat

Oct 18, 2011, 1:09 PM

Post #1 of 6 (852 views)
Permalink
beresp.cacheable on Varnish 3.

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);
}


jeroen.ooms at stat

Oct 18, 2011, 1:12 PM

Post #2 of 6 (834 views)
Permalink
Re: beresp.cacheable on Varnish 3. [In reply to]

Apologies, the varnish I am now running is not version 2.2 but version 3.


On Tue, Oct 18, 2011 at 1:09 PM, Jeroen Ooms <jeroen.ooms [at] stat>wrote:

> 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);
> }
>


bedis9 at gmail

Oct 18, 2011, 9:52 PM

Post #3 of 6 (828 views)
Permalink
Re: beresp.cacheable on Varnish 3. [In reply to]

On Tue, Oct 18, 2011 at 10:12 PM, Jeroen Ooms <jeroen.ooms [at] stat> wrote:
> Apologies, the varnish I am now running is not version 2.2 but version 3.
>
> On Tue, Oct 18, 2011 at 1:09 PM, Jeroen Ooms <jeroen.ooms [at] stat>
> wrote:
>>
>> 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);
>> }
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc [at] varnish-cache
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>

Hi,

This is what I do for Wordpress in vcl_fetch on varcnish 3 (afair, it
worked in 2.1):

set beresp.grace = 1d;

# wordpress
if (req.http.host ~ "XXXXXXXX" && !(req.url ~ "wp-(login|admin)")) {
unset beresp.http.set-cookie;
set beresp.cacheable = true;
}

if (beresp.cacheable && !beresp.http.cache-control) {
set beresp.ttl = 600s;
set beresp.http.cache-control = "max-age=600";
}


and 404 are cached.

Cheers

_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


Harri.Paivaniemi at tieto

Oct 18, 2011, 10:01 PM

Post #4 of 6 (853 views)
Permalink
RE: beresp.cacheable on Varnish 3. [In reply to]

Hi,

At least I remember that in vcl 3, besp.cacheable is gone and should use "set beresp.ttl = 0s;" to say it's not cacheable etc.

-hjp

________________________________________
From: varnish-misc-bounces [at] varnish-cache [varnish-misc-bounces [at] varnish-cache] On Behalf Of Baptiste [bedis9 [at] gmail]
Sent: 19 October 2011 7:52
To: Jeroen Ooms
Cc: varnish-misc [at] varnish-cache
Subject: Re: beresp.cacheable on Varnish 3.

On Tue, Oct 18, 2011 at 10:12 PM, Jeroen Ooms <jeroen.ooms [at] stat> wrote:

> Apologies, the varnish I am now running is not version 2.2 but version 3.
>
> On Tue, Oct 18, 2011 at 1:09 PM, Jeroen Ooms <jeroen.ooms [at] stat>
> wrote:
>>
>> 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);
>> }
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc [at] varnish-cache
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>

Hi,

This is what I do for Wordpress in vcl_fetch on varcnish 3 (afair, it
worked in 2.1):

set beresp.grace = 1d;

# wordpress
if (req.http.host ~ "XXXXXXXX" && !(req.url ~ "wp-(login|admin)")) {
unset beresp.http.set-cookie;
set beresp.cacheable = true;
}

if (beresp.cacheable && !beresp.http.cache-control) {
set beresp.ttl = 600s;
set beresp.http.cache-control = "max-age=600";
}


and 404 are cached.

Cheers

_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


bedis9 at gmail

Oct 19, 2011, 12:26 AM

Post #5 of 6 (852 views)
Permalink
Re: beresp.cacheable on Varnish 3. [In reply to]

ah, right, I thought I upgraded my varnish, but obviously I'm still
running "varnish-2.1.5 SVN".
I'll upgrade it very soon and share with you the impact on the configuration.

cheers


On Wed, Oct 19, 2011 at 7:01 AM, <Harri.Paivaniemi [at] tieto> wrote:
> Hi,
>
> At least I remember that in vcl 3, besp.cacheable is gone and should use "set beresp.ttl = 0s;" to say it's not cacheable etc.
>
> -hjp
>
> ________________________________________
> From: varnish-misc-bounces [at] varnish-cache [varnish-misc-bounces [at] varnish-cache] On Behalf Of Baptiste [bedis9 [at] gmail]
> Sent: 19 October 2011 7:52
> To: Jeroen Ooms
> Cc: varnish-misc [at] varnish-cache
> Subject: Re: beresp.cacheable on Varnish 3.
>
> On Tue, Oct 18, 2011 at 10:12 PM, Jeroen Ooms <jeroen.ooms [at] stat> wrote:
>
>> Apologies, the varnish I am now running is not version 2.2 but version 3.
>>
>> On Tue, Oct 18, 2011 at 1:09 PM, Jeroen Ooms <jeroen.ooms [at] stat>
>> wrote:
>>>
>>> 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);
>>> }
>>
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc [at] varnish-cache
>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>>
>
> Hi,
>
> This is what I do for Wordpress in vcl_fetch on varcnish 3 (afair, it
> worked in 2.1):
>
>        set beresp.grace = 1d;
>
>        # wordpress
>        if (req.http.host ~ "XXXXXXXX" && !(req.url ~ "wp-(login|admin)")) {
>                unset beresp.http.set-cookie;
>                set beresp.cacheable = true;
>        }
>
>        if (beresp.cacheable && !beresp.http.cache-control) {
>                set beresp.ttl = 600s;
>                set beresp.http.cache-control = "max-age=600";
>        }
>
>
> and 404 are cached.
>
> Cheers
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc [at] varnish-cache
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc [at] varnish-cache
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>

_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


hugo.cisneiros at gmail

Oct 19, 2011, 10:30 AM

Post #6 of 6 (828 views)
Permalink
Re: beresp.cacheable on Varnish 3. [In reply to]

On Tue, Oct 18, 2011 at 6:09 PM, Jeroen Ooms <jeroen.ooms [at] stat> wrote:
> 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'.

For a more detailed listing of changes from 2.x to 3, see:

https://www.varnish-cache.org/trac/browser/doc/changes.rst
Section: Changes from 2.1.5 to 3.0 beta 1 -> VCL

Many things changed.

Here I had to modify these items:

- return(pass) on vcl_fetch is now return(hit_for_pass)
- For concatenating strings, you must now put a "+" between them.
- obj.cacheable and beresp.cacheable are gone. Must change to *.ttl = 0s
- purge() function is now named ban()

--
[]'s
Hugo
www.devin.com.br

_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Varnish misc RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.