Is it possible to simulate this rewrite in vcl?

Poul-Henning Kamp phk at phk.freebsd.dk
Mon Sep 28 13:51:47 CEST 2009


In message <d340a0f10909280448v1bff8241u1f9d067373649de0 at mail.gmail.com>, Rob A
yres writes:

>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.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



More information about the varnish-misc mailing list