<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
Can't you add a custom header on your req object in vcl_recv that tells if it's a restart or not ?
<div><br>
</div>
<div>Then you check this header to know if you must create the hit_for_pass object. </div>
<div><br>
</div>
<div>Thierry</div>
<br>
<br>
<div style="font-size:100%;text-align:left;color:#000000">
<div>-------- Message d'origine --------</div>
<div>De : Laurent Lavaud <laurent.lavaud@ladtech.fr></laurent.lavaud@ladtech.fr></div>
<div>Date :05/11/2014 17:29 (GMT+01:00) </div>
<div>A : "MAGNIEN, Thierry" <thierry.magnien@sfr.com></thierry.magnien@sfr.com></div>
<div>Cc : varnish-misc@varnish-cache.org </div>
<div>Objet : Re: restart in varnish 4 </div>
<div><br>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">ok i have tried this solution, and it seems to work but i still have somes problems<br>
<br>
let me explain, in v3 my restart rule is the following one:<br>
<br>
if(beresp.status == 404 && req.restarts == 0) {<br>
  return(restart);<br>
}<br>
<br>
and i also have a rule to hit_for_pass object that is not a status 200:<br>
<br>
if (beresp.status != 200 && beresp.status != 206 && beresp.status != 301) {<br>
 return (hit_for_pass);<br>
}<br>
<br>
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.<br>
<br>
so i thought to add a special rule before the hit_for_pass, like this one:<br>
<br>
if(beresp.status == 404 && req.restarts == 0) {<br>
        return (deliver);<br>
}<br>
<br>
but in v4 i can't use req.restarts in vcl_backend_response... ! :(<br>
<br>
<br>
<br>
----- Mail original -----<br>
> You can check your resp.status in vcl_deliver and return(restart)<br>
> here.<br>
> <br>
> Regards,<br>
> Thierry<br>
> <br>
> -----Message d'origine-----<br>
> De : Laurent Lavaud [<a href="mailto:laurent.lavaud@ladtech.fr">mailto:laurent.lavaud@ladtech.fr</a>]<br>
> Envoyé : mercredi 5 novembre 2014 16:32<br>
> À : MAGNIEN, Thierry<br>
> Cc : varnish-misc@varnish-cache.org<br>
> Objet : Re: restart in varnish 4<br>
> <br>
> No it is not what i want because retry jump back to vcl_backend_fetch<br>
> and i cant set req.backend_hint in this vlc<br>
> <br>
> ----- Mail original -----<br>
> > Hi,<br>
> > <br>
> > Not sure bue this may be what you're looking for:<br>
> > <a href="https://www.varnish-cache.org/docs/trunk/whats-new/upgrading.html#backend-restarts-are-now-retry" target="_BLANK">
https://www.varnish-cache.org/docs/trunk/whats-new/upgrading.html#backend-restarts-are-now-retry</a><br>
> > <br>
> > Regards,<br>
> > Thierry<br>
> > <br>
> > -----Message d'origine-----<br>
> > De : varnish-misc-bounces+thierry.magnien=sfr.com@varnish-cache.org<br>
> > [<a href="mailto:varnish-misc-bounces+thierry.magnien=sfr.com@varnish-cache.org">mailto:varnish-misc-bounces+thierry.magnien=sfr.com@varnish-cache.org</a>]<br>
> > De la part de Laurent Lavaud<br>
> > Envoyé : mercredi 5 novembre 2014 16:14<br>
> > À : varnish-misc@varnish-cache.org<br>
> > Objet : restart in varnish 4<br>
> > <br>
> > Hello,<br>
> > <br>
> > In varnish 3 i do a restart in vcl_fetch when i have a 404 error<br>
> > from<br>
> > my backend, it allow me to set a different backend for the second<br>
> > request.<br>
> > <br>
> > With varnish 4 i cant do a restart in vcl_backend_response<br>
> > <br>
> > How can i achieve this ?<br>
> > <br>
> > _______________________________________________<br>
> > varnish-misc mailing list<br>
> > varnish-misc@varnish-cache.org<br>
> > <a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" target="_BLANK">
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
> ><br>
><br>
</div>
</span></font>
</body>
</html>