How to maintain virtualhost name in backend requests correctly

Harri.Paivaniemi at tieto.com Harri.Paivaniemi at tieto.com
Sat Aug 13 07:11:56 CEST 2011


Hi,

How can I tell varnish to do the backend request using the correct virtual host so that in backend, requests made by varnish are logged to the right virtual host log? In my backend there is 15 namevirtualhosts and now every req varnish makes comes to default apache-log, obviously because the req is not coming using name but a backend IP...

I tought "set req.http.Host = "dev.foo.fi";" would do the trick but not...


Thanks.

-hjp


---------------------------------------------------


if (req.http.Host ~ "dev\.foo\.fi") {
        set req.http.Host = "dev.foo.fi";
        
	..................

            set req.backend = xxxxx_http;
        }
     }


backend xxxxx_http {
    .host = "xx.xx.xx.xx";
    .port = "80";
    .probe = {
        .request = 
          "GET /crossdomain.xml HTTP/1.1"
          "Host: dev.foo.fi"
          "Connection: Close"
          "X-SE-CustomAuth: fffdfdfefrerefdfddfggfsul";
        .interval = 5 s;
        .timeout = 30 s;
        .window = 3;
        .threshold = 2;
    }
    .connect_timeout = 15s;
    .first_byte_timeout = 60s;
    .between_bytes_timeout = 60s;
}








More information about the varnish-misc mailing list