Help with caching and failover

Nick Tailor nick.tailor at gmail.com
Wed Aug 1 18:35:35 CEST 2012


Your missing set beresp.ttl

Cheers

Nick Tailor

Sent from my iPhone

On Aug 1, 2012, at 9:25 AM, nicola sabbi <nsabbi at officinedigitali.it> wrote:

> Hi,
> I'm trying to configure varnish 3.0.1 as a failover cache in front of a web server running EZ publish. 
> What I'd like to do is to let varnish cache pages for up to 4 hours. If the backend server is seen sick it should serve the last cached page for the current request (if available), otherwise serve an error page.
> 
> The backend polling code is working fine, but every time I tamper with the test page returning a 404 error code (in order to force the sick mode) varnish returns a 503 error to the client instead of the cached content, even though the cache is populated (or so I assume).
> 
> The configuration code I'm using is the following:
> 
> 
> backend default {
>         .host = "192.168.0.66";
>         .port = "80";
>         .probe = {
>                 .url = "http://backend/test.php";
>                 .timeout = 10s;
>                 .interval = 5s;
>                 .window = 3;
>                 .threshold = 3;
>                 .expected_response=200;
>         }
> }
> 
> sub vcl_recv {
>   if (req.backend.healthy) {
>     set req.grace = 30m;
>   } else {
>     set req.grace = 4h;
>   }
>   #return(lookup);
> }
> 
> sub vcl_fetch {
>    set beresp.grace = 8h;
>   #  return(restart);
> }
> 
> 
> 
> sub vcl_error {
>     set obj.http.Content-Type = "text/html; charset=utf-8";
>     set obj.http.Retry-After = "5";
>     synthetic {"
> Unavailable page!
> "};
>     return (deliver);
> }
> 
> Please, can you explain me what's missing or wrong  with this configuration?
> Thanks,
>   Nico
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20120801/55913e18/attachment.html>


More information about the varnish-misc mailing list