On Fri, Nov 29, 2013 at 5:04 AM, Norberto Meijome <[email protected]> wrote:
> +1, this is how we do this ( and similar tricks) > > @per, you suggested saint mode. Why? What would it do better than Tobias' > solution? > 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. Tobias solution is to have two backends. The other one is only used when the first one fails. Per. > Thx, > On 29/11/2013 3:10 AM, "Tobias Honacker" <[email protected]> > wrote: > >> Hi Jan, >> >> This is my solution: >> >> sub vcl_recv { >> >> // Redirect 404er Pictures - vcl_fetch will restart request and set new >> header to match with this rule >> if (req.http.host == "new-header.de") { >> if (req.url ~ "^/var/storage/images") { >> set req.backend = new_backend; >> } >> } >> } >> >> >> sub vcl_fetch { >> >> if ((beresp.status == 404) && (req.url ~ "^/var/storage/images")) >> { >> set req.http.Host = "new-header.de"; >> return(restart); >> } >> } >> >> >> You have to set a new header and restart the request thats it. >> >> >> Best regards, >> Tobias >> >> Am 28.11.13 16:15 schrieb "Jan-Frode Myklebust" unter <[email protected] >> >: >> >> >If you manage to do this, I would much appreciate you post a recipie :-) >> >I've been struggeling trying to achieve the same thing, without >> >success.. >> > >> >Actually my setup is a bit different, we have a director, and just want >> >to check the other backend if the first backend gives 404, but the same >> >solution might apply. >> > >> >backend backend1 { >> > .host = "backend1.example.com"; >> > .probe = { >> > .url = "/alive.html"; >> > .timeout = 34 ms; >> > .interval = 2s; >> > .window = 10; >> > .threshold = 8; >> > } >> >} >> >backend backend2 { >> > .host = "backend2.example.com"; >> > .probe = { >> > .url = "/alive.html"; >> > .timeout = 34 ms; >> > .interval = 2s; >> > .window = 10; >> > .threshold = 8; >> > } >> >} >> >director dir1 client { >> > { .backend = backend1; .weight = 1; } >> > { .backend = backend2; .weight = 1; } >> >} >> >sub vcl_recv { >> > if ( req.http.host ~ "(?i)www.example.com$" ) { >> > set req.backend = dir1; >> > return(lookup); >> > } >> >} >> > >> > >> > >> > -jf >> >> >> >> _______________________________________________ >> 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 > -- <http://www.varnish-software.com/> *Per Buer* CTO | Varnish Software AS Phone: +47 958 39 117 | Skype: per.buer We Make Websites Fly! Winner of the Red Herring Top 100 Europe Award 2013
_______________________________________________ varnish-misc mailing list [email protected] https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
