On Wed, Jul 27, 2011 at 5:18 PM, Mattias Geniar <[email protected]> wrote:
> > I have a main website running which has now been translated to > different languages. The different language sites are running on > different backend servers. I want to redirect/distribute traffic to > backends based on the url without rewriting the url/host. > > That's possible, you can set a different backend based on a (part of > the) URL. Have a look here: > https://www.varnish-cache.org/docs/trunk/tutorial/advanced_backend_serve > rs.html > > Specifically, you'd want something as: > sub vcl_recv { > if (req.url ~ "^/en/") { > set req.backend = backend_en; > } elseif (req.url ~ "^/hi/" { > set req.backend = backend_hi; > } > } > > Regards, > Mattias > This doesn't work... if (req.http.host == "www.domain.com" && req.url ~ "^/hi$") { set req.backend = hiserver; } elseif (req.http.host == "www.domain.com" && req.url ~ "^/$") { # if /hi is not specified, i.e go to / set req.backend = enserver; } else {set req.backend = default; } # all other sites go here All requests are going to "default" or "enserver". Kindly help, thanks in advance. ShiB. while ( ! ( succeed = try() ) );
_______________________________________________ varnish-misc mailing list [email protected] https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
