Regarding this old thread: >> I've had to put an instance of apache behind varnish as a redirector as I >> can't think of a way of making varnish do it. Can this apache rewrite be >> done in vcl? >> >> RewriteRule ^/(.*)/home/(.*)$ http://$1_host.example.com/$2 [P] > > Not right of the bat. > > Provided you add backend instances for all the servers serving > these domains it is possible, but you need to do the $1 part as > a if/elseif/elseif/elseif/.../else to set the req.backend.
Something I have just published recently might help: http://varnish-cache.org/ticket/666 I haven't tested Rob's specific case, but something like the following *SHOULD* work (don't pick on syntax errors please): if (req.url ~ "(.*)/home/(.*)") { set req.url = pmatch.2; if (pmatch.1 == "server1") { set req.backend = "server1"; } elseif (pmatch.1 == "server2") { ... } else { error 543 "wrong server" } } Please report bugs of the pmatch feature if you find any. Cheers, Nils _______________________________________________ varnish-misc mailing list [email protected] http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
