req.http.host with port numbers

Geoff Crompton geoffc at trinity.unimelb.edu.au
Mon Aug 23 04:19:29 CEST 2010


Is VCL meant to handle port numbers in HTTP Host headers more 
gracefully? I was trying to check my varnish configuration by calling 
the nagios-plugins check_http utility, and to get it to work I had to 
add line 3 in the following:

1 sub vcl_recv {
2     if (req.http.host == "www.trinitycollege.vic.edu.au" ||
3         req.http.host == "www.trinitycollege.vic.edu.au:80") {
4         set req.backend = backend;
5     }

Here is some output from varnishlog that shows that the check_http 
program formats it's Host header with a port number.
     7 RxRequest    c GET
     7 RxURL        c /
     7 RxProtocol   c HTTP/1.1
     7 RxHeader     c Host: www.trinitycollege.vic.edu.au:80
     7 RxHeader     c User-Agent: check_http/v1991 (nagios-plugins 1.4.12)
     7 RxHeader     c Connection: close

I thought that was a bit odd, but apparently it's permitted in RFC 2616. 
I wonder if varnish should decode such a header to something like:
  req.http.host = "www.trinitycollege.vic.edu.au"
  req.http.hostport = "80"

Is this worth a bug report?
-- 
+-Geoff Crompton
+--Debian System Administrator
+---Trinity College




More information about the varnish-dev mailing list