cache site for 1 hour

MAGNIEN, Thierry thierry.magnien at sfr.com
Mon Nov 10 10:21:57 CET 2014


Hi.

You should match against req.http.host, not req.url.

Consider using grace mode too in order to achieve what you want.

Regards,
Thierry


-------- Message d'origine --------
De : Tim Dunphy
Date :10/11/2014 05:31 (GMT+01:00)
A : varnish-misc at varnish-cache.org
Objet : cache site for 1 hour

Hey guys,

 I'm trying to keep a copy of the site I'm working on in cache for 1 hour. My goal is to be able to stop the web server(s) completely, and have the site served from cache in a worst case scenario.

 So I tried adding the following vcl_fetch to my default.vcl file expecting this to be a success. But when I stop the web server the site immediately disappears with a GURU Meditation error showing in the web browser:

sub vcl_fetch {

   if ( req.url ~ "^www\.ref\.mydomain\.com$") {
   set beresp.ttl = 3600s;
   }

    return (deliver);
}


I'd definitely appreciate any advice you'd have!

Thanks
Tim
--
GPG me!!

gpg --keyserver pool.sks-keyservers.net<http://pool.sks-keyservers.net> --recv-keys F186197B

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20141110/ae83a908/attachment.html>


More information about the varnish-misc mailing list