redirect in varnish

Anders Nordby anders at fupp.net
Wed Aug 6 16:18:24 CEST 2008


Hi,

On Mon, Apr 28, 2008 at 09:47:16PM +0000, Poul-Henning Kamp wrote:
> 	if (req.http.host == "www.bla.com") {
> 		set req.http.host = "www.bla1.com";
> 	}

Trying a VCL like this (this is my entire VCL, used as an example), I do
not get a redirect:

backend default {
        .host = "192.168.0.1";
        .port = "80";
}

sub vcl_recv {
        set req.http.host = "www.foobar.no";
        set req.http.url = "/";
        lookup;
}

Instead of doing a redirect, it fetches pages off the default backend.
Why? How do I redirect to another URL on a different host, not served by
Varnish?

PS: Another thing, the first backend seems to become the default one,
even though there is no backend called "default". Shouldn't it respond
with 503 Service Unavailable instead? I like to control what is default
and not.

Cheers,

-- 
Anders.



More information about the varnish-misc mailing list