[Varnish] #248: Varnish doesn't automatically send host header if back-end is specified using hostname

Varnish varnish-bugs at projects.linpro.no
Wed Jun 11 14:56:54 CEST 2008


#248: Varnish doesn't automatically send host header if back-end is specified
using hostname
----------------------+-----------------------------------------------------
 Reporter:  peter     |       Owner:  phk  
     Type:  defect    |      Status:  new  
 Priority:  normal    |   Milestone:       
Component:  varnishd  |     Version:  trunk
 Severity:  normal    |    Keywords:       
----------------------+-----------------------------------------------------
 Not sure if this really is a bug.

 I specified my back-end using it's hostname. However the server in
 question serves more than one domain using virtual hosts. It seems Varnish
 only uses the hostname to resolve the IP of the server. It doesn't however
 send a "Host: ..." header with the same hostname to the server. This means
 the server isn't able to determine for which host a page is requested and
 it falls back to the default (if there is any). I expected however that it
 would send a host header with the back-end hostname.

 I've solved this for my specific case by adding the host header myself
 using the following VCL code:
 {{{
 sub vcl_recv {
   set req.http.Host = "dev";
   lookup;
 }
 }}}
 My back-end specification looks like follows:
 {{{
 backend default {
   .host = "dev";
   .port = "http";
 }
 }}}

-- 
Ticket URL: <http://varnish.projects.linpro.no/ticket/248>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator


More information about the varnish-bugs mailing list