localhost

Hettwer, Marian mhettwer at team.mobile.de
Mon Mar 28 17:24:51 CEST 2011


On 28.03.11 13:24, "Stefan Welschhoff" <s.welschhoff at lvm.de> wrote:

>Hello,

Hi there,

>
>I am very new in varnish. I try to get a return code 200 when varnish
>opens the default backend. The default backend will be localhost. Is it
>possible?

Short answer: Yes, if your backend behaves well.

Little longer answer:

If you configure a backend like that:
backend default {
     .host = "127.0.0.1";
     .port = "8080";
}


And assuming that your backend really listens on localhost:8080, then use
the following in vcl_recv:

sub vcl_recv {
 set req.backend = default;

}

Now start varnish, and assuming you let varnish listen on localhost:80 you
can do something like that

wget -0 /dev/null -q -S http://localhost/foo.txt

The request GET /foo.txt goes to varnish and he forwards this to your
backend at localhost:8080.

If "wget -0 /dev/null -q -S http://localhost:8080/foo.txt" works, then
"wget -0 /dev/null -q -S http://localhost/foo.txt" will work too.

Cheers,
Marian

PS.: Start with the fine documentation of varnish!





More information about the varnish-misc mailing list