Hi all I have a webserver over which I have no control. It's a managed CMS solution running Apache, however the vendor will not allow us to add URL rewriting rules or virtual hosts to the configuration.
It serves different websites at the following URLs: http://example.com http://example.com/dlc http://example.com/wyc I'm hoping I can use Varnish to sit between the web server and my users to disguise the subfolders in to separate domains - eg Client URL => Backend URL http://example.com => http://example.com http://example.com/index.phtml?d=12345 => http://10.108.1.59/index.phtml?d=12345 http://www.deansleisurecentre.com => http://10.108.1.59/dlc http://www.deansleisurecentre.com/index.phtml?d=12121 => http://10.108.1.59/index.phtml?d=12121 http://www.woodingdeanyc.org.uk => http://10.108.1.59/wyc http://www.woodingdeanyc.org.uk/index.phtml?d=54321 => http://10.108.1.59/index.phtml?d=54321 DNS for deansleisurecentre.com and woodingdeanyc.org.uk would point to the server running Varnish on port 80. The client should not see the redirect to /dlc or /wyc (ie so that it thinks it's looking at the root of the domain). Once the client has connected, /dlc is redirected by the CMS to a url like /index.phtml?d=12345 and all subsequent pages use that format. The CMS will be happy with deansleisurecentre.com/index.phtml?d=12345. I've setup a Debian box using testing and installed the varnish package 1.1.2. Here is my current config: default.vcl backend default { set backend.host = "10.108.1.59"; set backend.port = "80"; } sub vcl_recv { if (req.http.host ~ "^(www.)?deansleisurecentre.com") { set req.http.host = "deansleisurecentre.com"; set req.http.url = regsub(req.url, "^/$", "/dlc"); } if (req.request != "GET" && req.request != "HEAD") { pipe; } if (req.http.Expect) { pipe; } if (req.http.Authenticate || req.http.Cookie) { pass; } lookup; } I've edited my local PCs hosts file to point deansleisurecentre.com to the box running Varnish, however when I access deansleisurecentre.com, I get http://example.com instead without the rewrite. Looking at the logs, it appears Varnish is doing the rewrite in the headers correctly, but the RxURL and TxURL fields always match - surely shouldn't the TxURL change to match the URL shown in the header (which selectively includes my URL rewrite?). I saw an example using berew.http.url however I can only seem to get that to work in vcl_hit subroutine (currently commented out in my config) and it seems to make no difference when used. Can Varnish do what I want, and if so, does anyone have a pointer that would help me track down the right config?! Thanks Alex -- Alex Harrington - Network Manager, Longhill High School t: 01273 304086 | e: [EMAIL PROTECTED] _______________________________________________ varnish-misc mailing list [email protected] http://projects.linpro.no/mailman/listinfo/varnish-misc
