Can't you add a custom header on your req object in vcl_recv that tells if it's a restart or not ?
Then you check this header to know if you must create the hit_for_pass object. Thierry -------- Message d'origine -------- De : Laurent Lavaud Date :05/11/2014 17:29 (GMT+01:00) A : "MAGNIEN, Thierry" Cc : [email protected] Objet : Re: restart in varnish 4 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:[email protected]] > Envoyé : mercredi 5 novembre 2014 16:32 > À : MAGNIEN, Thierry > Cc : [email protected] > 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 : [email protected] > > [mailto:[email protected]] > > De la part de Laurent Lavaud > > Envoyé : mercredi 5 novembre 2014 16:14 > > À : [email protected] > > 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 > > [email protected] > > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc > > >
_______________________________________________ varnish-misc mailing list [email protected] https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
