restart in varnish 4

Laurent Lavaud laurent.lavaud at ladtech.fr
Wed Nov 5 17:29:11 CET 2014


ok i have tried this solution, and it seems to work but i still have somes problems

let me explain, in v3 my restart rule is the following one:

if(beresp.status == 404 && req.restarts == 0) {
  return(restart);
}

and i also have a rule to hit_for_pass object that is not a status 200:

if (beresp.status != 200 && beresp.status != 206 && beresp.status != 301) {
 return (hit_for_pass);
}

so now in v4 if i restart in vcl_deliver, i have an hit_for_pass object inserted in the cache (because status 404), and it is not good.

so i thought to add a special rule before the hit_for_pass, like this one:

if(beresp.status == 404 && req.restarts == 0) {
        return (deliver);
}

but in v4 i can't use req.restarts in vcl_backend_response... ! :(



----- Mail original -----
> You can check your resp.status in vcl_deliver and return(restart)
> here.
> 
> Regards,
> Thierry
> 
> -----Message d'origine-----
> De : Laurent Lavaud [mailto:laurent.lavaud at ladtech.fr]
> Envoyé : mercredi 5 novembre 2014 16:32
> À : MAGNIEN, Thierry
> Cc : varnish-misc at varnish-cache.org
> Objet : Re: restart in varnish 4
> 
> No it is not what i want because retry jump back to vcl_backend_fetch
> and i cant set req.backend_hint in this vlc
> 
> ----- Mail original -----
> > Hi,
> > 
> > Not sure bue this may be what you're looking for:
> > https://www.varnish-cache.org/docs/trunk/whats-new/upgrading.html#backend-restarts-are-now-retry
> > 
> > Regards,
> > Thierry
> > 
> > -----Message d'origine-----
> > De : varnish-misc-bounces+thierry.magnien=sfr.com at varnish-cache.org
> > [mailto:varnish-misc-bounces+thierry.magnien=sfr.com at varnish-cache.org]
> > De la part de Laurent Lavaud
> > Envoyé : mercredi 5 novembre 2014 16:14
> > À : varnish-misc at varnish-cache.org
> > Objet : restart in varnish 4
> > 
> > Hello,
> > 
> > In varnish 3 i do a restart in vcl_fetch when i have a 404 error
> > from
> > my backend, it allow me to set a different backend for the second
> > request.
> > 
> > With varnish 4 i cant do a restart in vcl_backend_response
> > 
> > How can i achieve this ?
> > 
> > _______________________________________________
> > varnish-misc mailing list
> > varnish-misc at varnish-cache.org
> > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
> >
>



More information about the varnish-misc mailing list