squid.conf and Squid 2.6 vs. Squid 2.7
I ran into a problem switching from Squid 2.6 to Squid 2.7. The details are available at http://
By trying various configs I found a fix: adding "vport=80" to the http_port line in squid.conf made the problem go away. Since I wasn't sure exactly why that worked I posted a query on squid-users. There's a response at http://<email address hidden>
First, these comments were made by Henrik Nordstrom in response to a bug report. (This is the change that broken things from the recipe's perspective.)
It's fine to combine vhost defaultsite vport in the same port specification,
and acheives what you are looking for.
1. If there is a Host header, use it's site name and port (if any).
2. If there was no port in the Host header use the vport assigned port number.
3. If there was no Host header then use defaultsite for both the hostname and
Or alternatively just vhost vport, in which case it n 3 falls back on the
incoming ip:port if there is no Host header.
defaultsite, vport, vhost is all options defining how Squid is to rebuild the
requested URL when given a URL-Path.. Or put in a different angle it should not
react differently when given an absolute-URI compared to a URL-Path + Host
If using Host header and it has a port, that's the port.
If not then the http_port, possibly overridden by vport=NN.
This patch also changes the default site to be visible_hostname, overridden by
defaultsite or ip based vport (without =NN), as this is what most people
Second, this was Amos' summary of how it works (from the parallel thread).
"accel vhost defaultsite=
... 'accelerate' the URL.
... (vhost) use client-given Host: header when available.
... (vport=) use the client-given Host: HTTP port (default 8088 if none
... (defaultsite=) use 192.168.24.198 if neither of the above give a usable
So Squid check the URL. Finds /rdims/index.jsp.
... checks the Host: header. Finds 192.168.0.164:88, making
... checks the Host: header port. Finds 88, making
... has a domain '192.168.0.164', so skips defaultsite
Interestingly, having taken a very quick look at the code I think his description is slightly wrong. I believe that if vport is passed a specific port number it *always* becomes the port:
if (vport > 0)
port = vport;
port = htons(http-
But, hey, I only read a snippet, so don't just take my word for it. :-) I think, though, that that's why it fixes the problem in 2.7.
(The 2.6 code has a similar intent:
- if (vport)
- snprintf(http->uri, url_sz, "%s://%s:%d%s",
but I don't know whether or not it has a similar effect.)
Two other notes.
First, in template-vhm.conf there's no "accel" on the http_port line. I think it should be there. First, it's in the sample VHM config at http://
Second, Amos made this comment:
>> # Cache Peer Access
>> acl all src 0.0.0.0/0.0.0.0
> Please make that "acl all src all". And note that it needs to be removed
> entirely for squid 3.x to work.