varnish serve old object during refresh

Jaap van Arragon j.vanarragon at lukkien.com
Mon Jan 30 15:23:15 CET 2012


Hello,

How can I serve an old object during the fetch of an expired object or max
out connection?

I¹ve configured the grace period in both the vcl_recv as the vcl_fetch.

I even tried to use the saint mode to give me back an ³old² cached object.

Can somebody give me help in this matter?

sub vcl_recv {

    # Purge through http
    if (req.request == "PURGE") {
        if (!client.ip ~ purge) {
            error 405 "Not allowed.";
        }
        ban("req.url ~ " + req.url );
        error 200 "Purged.";
    }

    # Unset all cookies available
    if (req.http.cookie) {
        unset req.http.cookie;
    }

     if (req.request != "GET" && req.request != "HEAD") {
        /* We only deal with GET and HEAD by default */
        return (pass);
    }

    # Adding Grace period in case backend lags
    set req.grace = 3d;
    return (lookup);
}
....
sub vcl_fetch {
    set beresp.grace = 4d;
    set beresp.saintmode = 50s;
    set beresp.ttl = 30s;
    return (deliver);
}


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


More information about the varnish-misc mailing list