Different cache policy for googlebot

David Turner david at collaborativebusiness.co.uk
Thu Dec 2 15:17:50 CET 2010

On 2 Dec 2010, at 13:09, Tollef Fog Heen wrote:

> Sounds like you want to set obj.grace to a high value, and then set
> req.grace to low values for humans, and a higher value for robots and
> turn on saint mode for robots.  At least I think that'll fix your use
> case.

On your advice Tollef I tried the following test configuration and sent requests using lwp-request to change the user agent string.

sub vcl_fetch {
	set beresp.ttl = 10s;
        set beresp.grace = 60s;

sub vcl_recv {
        if ( req.http.user-agent ~ "foo" ) {
                set req.grace = 30s;
        } else {
                set req.grace = 5s;

But that's just expiring content for either user-agent case according to the ttl. I think it must be the saint mode, but I don't understand how to set that for a specific user agent, as I read the documentation I should use grace mode OR saintmode and the parameter is set on the beresp object. 

I missed something I'm sure...

David M Turner <david at collaborativebusiness.co.uk>
Collaborative Business Services Ltd

Tel: +44 161 850 0586

Collaborative Business Services Ltd is a private limited company
registered in England and Wales. Registered number: 6666362
Registered office: Floor 10, 3 Hardman Street, Manchester, M3 3HF

More information about the varnish-misc mailing list