<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>
<p dir="ltr">Thx,</p>
<div class="gmail_quote">On 29/11/2013 3:10 AM, "Tobias Honacker" <<a href="mailto:t.honacker@googlemail.com">t.honacker@googlemail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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">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>
_______________________________________________<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>