TxHeader host and RxHeader host

Dag-Erling Smørgrav des at linpro.no
Sun Jul 29 23:09:45 CEST 2007


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



More information about the varnish-misc mailing list