Ignoring refresh / force-refresh from the client

Reinis Rozitis r at roze.lv
Fri May 28 16:37:16 CEST 2010


To ignore clients headers regarding cache this should be enough imo:

sub vcl_recv {
   unset req.http.Cache-Control;
}



You can also override the backends cache settings.

For example because of some performance concerns (in case of broken image/resource the backend wont be hammered by the client 
againt) we do something like this (in case the backend server "decides" to return something with less than 10 minutes cache 
timeout):

sub vcl_fetch {
    if (beresp.ttl < 10m) {
             set beresp.ttl = 10m;
    }
    return (deliver);
}



rr

----- Original Message ----- 
From: <andrea.campi at zephirworks.com>
To: <varnish-misc at varnish-cache.org>
Sent: Friday, May 28, 2010 4:15 PM
Subject: Ignoring refresh / force-refresh from the client


> Hi guys,
>
> I'm working with a client who has an emergency (a backend webapp  misbehaving because of sluggishness under load), so I deployed 
> varnish  in front to relieve the load.
>
> The input from the customer is that the underlaying data doesn't  change more often that 4 hours, so it would be good to be able 
> to not  send requests for a given URL more often than that.
>
> The basic setup was a piece of cake, but I'd like to also "lie" to  users that hit refresh (and even forced refresh, if possible) 
> and  still serve the request from the cache, as long as the page is fresh.
>
> However in my tests a refresh from e.g. Firefox (with a  "Cache-Control: max-age=0") causes the URL to be purged from the cache 
> and fetched from the backend.
> AFAICT obj.cacheable is still true, so I'm not sure why is that happening.
>
> I've tried unsetting/removing req.http.cache-control and had no success.
> I've also tried sending Age: 0, also no success.
>
> Any suggestion, or pointer to documentation/blog posts/source code/whatever?
>
> In case it matters: the backend is sending an Expires header 4 hours  in the future, no ETag. I'm also sending a max-age.
>
> Thanks in advance, bye,
>   Andrea
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
> 





More information about the varnish-misc mailing list