Varnish returns default host instead of virtual host
Caunter, Stefan
scaunter at topscms.com
Mon Jun 7 17:35:52 CEST 2010
-----Original Message-----
From: varnish-misc-bounces at varnish-cache.org [mailto:varnish-misc-bounces at varnish-cache.org] On Behalf Of Marcus Smith
Sent: June-07-10 11:21 AM
To: varnish-misc at varnish-cache.org
Subject: Re: Varnish returns default host instead of virtual host
Lars Monsees wrote:
> Hi,
>
> I am very new to Varnish and have only configured my backend as I
> guess Varnish will use default values that should work for the
> beginning. The problem is that Varnish returns the content of the
> server´s default domain (the standard "it work´s" text") instead of
> the content of the wanted domain.
> backend default {
> .host = "127.0.0.1";
> .port = "80";
> }
It looks like the backend is on the same machine that varnish is running
on. In that case, it needs to be listening on a port other than 80 as
you have above, as varnish will be bound to port 80 by default.
best wishes,
Marcus
Hi Lars and Marcus:
Varnish would not start if the port was not available, and it's returning the default page because it doesn't know about a host header (yet).
Add this for your domain name.
if (req.http.host ~ "^(www.)?example.com") {
set req.http.host = "www.example.com";
}
Stefan
More information about the varnish-misc
mailing list