+1, this is how we do this ( and similar tricks) @per, you suggested saint mode. Why? What would it do better than Tobias' solution?
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
