<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 29, 2013 at 5:04 AM, Norberto Meijome <span dir="ltr"><<a href="mailto:numard@gmail.com" target="_blank">numard@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">+1, this is how we do this ( and similar tricks)</p>
<p dir="ltr">@per, you suggested saint mode. Why? What would it do better than Tobias' solution?</p></blockquote><div><br></div><div>Saint mode works if you have two backends in the same director. Then it blacklists that object from that backend for a certain time. A restart would then direct the request to the other backend.</div>

<div><br></div><div>Tobias solution is to have two backends. The other one is only used when the first one fails.</div><div><br></div><div>Per.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<p dir="ltr">Thx,</p>
<div class="gmail_quote"><div><div class="h5">On 29/11/2013 3:10 AM, "Tobias Honacker" <<a href="mailto:t.honacker@googlemail.com" target="_blank">t.honacker@googlemail.com</a>> wrote:<br type="attribution">

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Hi Jan,<br>
<br>
This is my solution:<br>
<br>
sub vcl_recv {<br>
<br>
// Redirect 404er Pictures - vcl_fetch will restart request and set new<br>
header to match with this rule<br>
if (req.http.host == "<a href="http://new-header.de" target="_blank">new-header.de</a>") {<br>
       if (req.url ~ "^/var/storage/images") {<br>
           set req.backend = new_backend;<br>
       }<br>
        }<br>
}<br>
<br>
<br>
sub vcl_fetch {<br>
<br>
        if ((beresp.status == 404) && (req.url ~ "^/var/storage/images")) {<br>
     set req.http.Host = "<a href="http://new-header.de" target="_blank">new-header.de</a>";<br>
     return(restart);<br>
        }<br>
}<br>
<br>
<br>
You have to set a new header and restart the request thats it.<br>
<br>
<br>
Best regards,<br>
Tobias<br>
<br>
Am 28.11.13 16:15 schrieb "Jan-Frode Myklebust" unter <<a href="mailto:janfrode@tanso.net" target="_blank">janfrode@tanso.net</a>>:<br>
<br>
>If you manage to do this, I would much appreciate you post a recipie :-)<br>
>I've been struggeling trying to achieve the same thing, without<br>
>success..<br>
><br>
>Actually my setup is a bit different, we have a director, and just want<br>
>to check the other backend if the first backend gives 404, but the same<br>
>solution might apply.<br>
><br>
>backend backend1 {<br>
>        .host = "<a href="http://backend1.example.com" target="_blank">backend1.example.com</a>";<br>
>        .probe = {<br>
>                .url = "/alive.html";<br>
>                .timeout = 34 ms;<br>
>                .interval = 2s;<br>
>                .window = 10;<br>
>                .threshold = 8;<br>
>        }<br>
>}<br>
>backend backend2 {<br>
>        .host = "<a href="http://backend2.example.com" target="_blank">backend2.example.com</a>";<br>
>        .probe = {<br>
>                .url = "/alive.html";<br>
>                .timeout = 34 ms;<br>
>                .interval = 2s;<br>
>                .window = 10;<br>
>                .threshold = 8;<br>
>        }<br>
>}<br>
>director dir1 client {<br>
>    { .backend = backend1; .weight = 1; }<br>
>    { .backend = backend2; .weight = 1; }<br>
>}<br>
>sub vcl_recv {<br>
>        if ( req.http.host ~ "(?i)<a href="http://www.example.com" target="_blank">www.example.com</a>$"  ) {<br>
>                set req.backend = dir1;<br>
>                return(lookup);<br>
>        }<br>
>}<br>
><br>
><br>
><br>
>  -jf<br>
<br>
<br>
<br></div></div><div class="im">
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><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>
</div></blockquote></div>
<br>_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><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></blockquote></div><br><br clear="all"><div><br></div>-- <br>

<div dir="ltr"><div style="font-size:12.727272033691406px;margin:5px 15px 0px 0px;padding-bottom:5px;color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)"><table border="0" cellpadding="0" cellspacing="0" style="text-align:start;font-size:12px;line-height:1.5em;font-family:'Helvetica Neue',Arial,sans-serif;color:rgb(102,102,102);width:550px;border-top-width:1px;border-top-style:solid;border-top-color:rgb(238,238,238);border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);margin-top:20px;padding-top:5px;padding-bottom:5px">

<tbody><tr><td width="100" style="font-family:arial,sans-serif;margin:0px"><a href="http://www.varnish-software.com/" style="color:rgb(17,85,204)" target="_blank"><img src="http://www.varnish-software.com/static/media/logo-email.png" style="float:left;margin-left:10px"></a></td>

<td style="font-family:arial,sans-serif;margin:0px"><b style="font-size:14px;color:rgb(34,34,34)">Per Buer</b><br>CTO | Varnish Software AS<br>Phone: +47 958 39 117 | Skype: per.buer<br><span style="font-weight:bold">We Make Websites Fly!<br>

<br></span><span style="font-family:'Helvetica Neue',Arial,sans-serif;font-size:14px;font-weight:bold">Winner of the Red Herring Top 100 Europe Award 2013<br></span><p style="margin:0px;line-height:normal;font-family:Helvetica">

<img src="https://www.varnish-software.com/sites/default/files/redherring_2013_winner_sml.jpg"></p><span style="font-weight:bold"><br></span></td></tr></tbody></table><div></div></div><div style="font-size:12.727272033691406px;margin:15px 0px;clear:both;color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)">

</div></div>
</div></div>