redirect in varnish

Poul-Henning Kamp phk at
Wed Aug 6 18:05:24 CEST 2008

In message <20080806145732.GA85993 at>, Anders Nordby writes:
>On Wed, Aug 06, 2008 at 02:28:01PM +0000, Poul-Henning Kamp wrote:
>>>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
>> You need to define that host as a backend.
>Did that (and changed req.http.url to req.url - my mistake). This makes
>Varnish fetch the content on that url/host, but instead of redirecting
>(301/302 http code) it just fetches and returns the content (200 http
>code). I want to redirect, not just fetch the content. Also it would be
>nice to specify 301 or 302 http code for the redirect.

	error 301;

Set the headers in vcl_error{}

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