not serving from Cache

Vitaly Burshteyn vburshteyn at broadway.com
Sat May 29 05:27:55 CEST 2010


Hi folks, thanks in advance.

 

So I have varnish running on 2.1.1 with the load balance feature that
works great.  Everything works, exept that if I shut down the backend I
get 503 erros.  Aka nothing is served from cache..

 

 

Any ideas as to what I am going wrong in my vlc file?

 

Thanks,

 

 

 

 

 

 

 

backend server1 {

        .host = "";

}

 

backend server2 {

        .host = "";

     }

 

director bw round-robin {

    { .backend = server1;    }

    { .backend = server2;    }}

 

 

sub vcl_recv {

set req.backend = bw;

if (req.url ~ "/") {

       unset req.http.cookie;    }

if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") {

   return(lookup); }

 

    # Redirect requests to /admin/ to /oops/

    if (req.url ~ "^/admin/"){

    set req.url = regsub(req.url, "^/admin/", "/oops/");    }

 

    # Never cache this path

    if (req.url ~ "/affiliates/visa-signature/") {

        return(pass);    }

 

    if (req.url ~ "^/r/\d+/") {

        return(pass);    }

 

    # Don't cache if specific HTTP headers exist

    if (req.http.Expect) {

        return(pass);    }

    if (req.http.Authorization) {

        return(pass);   }

set req.grace = 60m;

}

sub vcl_fetch {

    set beresp.ttl = 120s;

    set beresp.grace = 200s;

 

   if ( beresp.status == 500) {

         set beresp.grace = 60s;

         restart;

     }

 

   if (req.url ~ "/") {

        unset beresp.http.set-cookie;

   }

 

 

if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") {

   unset beresp.http.set-cookie;

}

 

    # Don't cache error pages

    if (beresp.status == 503) {

        return(pass);    }

 

    # Varnish will dutifully serve different objects for different
values

    # of "Cookie: foo" if "Vary:" contains "Cookie". We don't want this.

    if (beresp.http.Vary == "Cookie") {

        remove beresp.http.Vary;

    }

 

    # Anti-dogpiling feature - serve a stale request until a new one

    # can be fetched, for up to 30s

 

    if (!beresp.cacheable) {

       return(deliver);

       }

 

    return(deliver);

}

 

sub vcl_hit {

  remove obj.http.Set-Cookie;

}


____________________________________
The information contained in this transmission may contain privileged 
and confidential information.  It is intended only for the use of the 
person(s) named above. If you are not the intended recipient,  you are 
hereby notified that any review, dissemination, distribution or 
duplication of this communication is strictly prohibited. If you are 
not the intended recipient, please contact the sender by reply email 
and destroy all copies of the original message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20100529/5ece6084/attachment-0002.html>


More information about the varnish-misc mailing list