Mailing List Archive

TxHeader host and RxHeader host
Both of those should be the same host ? I'm asking because in my varnishlog allways TxHeader and RxHeader host are my server with varnish ... non with backend ..
TxHeader host and RxHeader host [ In reply to ]
rad_kam at tlen.pl writes:
> Both of those should be the same host ? I'm asking because in my
> varnishlog allways TxHeader and RxHeader host are my server with
> varnish ... non with backend ..

Rx and Tx mean "receive" and "transmit" respectively. A request header
will be logged as RxHeader when received from the client, and with
TxHeader when sent to the backend. Likewise, a response header will be
logged as RxHeader when received from the backend and as TxHeader when
sent to the client.

Varnish uses whatever Host: header it received from the client;
otherwise it wouldn't be able to accelerate servers with multiple
virtual hosts. If the Host: header you get from the client is not
correct, you can adjust req.http.host it in vcl_recv or bereq.http.host
in vcl_miss, e.g.:

vcl_recv {
if (req.http.host ~ "^(www\.)?example.com$") {
req.backend = example_backend;
req.http.host = "backend.example.com";
} else {
error 404 "Unknown virtual host";
}
}

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no
TxHeader host and RxHeader host [ In reply to ]
you wrote:

vcl_recv {
if (req.http.host ~ "^(www\.)?example.com$") {
req.backend = example_backend;
req.http.host = "backend.example.com";
} else {
error 404 "Unknown virtual host";
}
}


i have :

backend other {
set backend.host = "mywebsite";
set backend.port = "80";
}

if (req.http.host ~ "^my.server.with.varnish")
{
set req.backend = other;
} else {
error 404 "The host listed in your request is
not recognized";
}

Is this the same? I'm asking because your configuration won't work ( I have varnish 1.0.2)
TxHeader host and RxHeader host [ In reply to ]
rad_kam at tlen.pl writes:
> Is this the same? I'm asking because your configuration won't work ( I
> have varnish 1.0.2)

You could have told us that a little earlier. Please upgrade to 1.1.

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no
Re: TxHeader host and RxHeader host [ In reply to ]
Allready upgraded, but when run varnish get this error:

Expected action, 'if' or '}'
(/opt/varnish/etc/vcl.conf Line 21 Pos 18)
req.backend = apache;
-----------------###########----------
Re: Re: TxHeader host and RxHeader host [ In reply to ]
Allright , i forgot write "set" ;)

But have another question: how can I change TxHeader ?
TxHeader host and RxHeader host [ In reply to ]
In message <2cb8c7a9.3c7f4d01.46acffc7.319d0 at o2.pl>, rad_kam at tlen.pl writes:

>Both of those should be the same host ? I'm asking because in my
>varnishlog allways TxHeader and RxHeader host are my server with
>varnish ... non with backend ..

Unless you modify them in VCL, they are whatever the client sends.

--
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.