Re: [squid-users] squid vport

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Tue, 29 Sep 2009 16:51:53 +1200

Note: If Henrik corrects me on any of this believe him. I'm a little bit
fuzzy too.

On Tue, 29 Sep 2009 11:50:49 +0800, "wangwen" <wangw330_at_126.com> wrote:
> Hi All:
>
> The vport option Confused me for a long time.
> what is the meaning of "vport" option in the "http_port"?
> Can anyone give me an example to explain it, thank you.
>
> I did a test.
> The Squid.conf as follows:
> http_port 192.168.0.164:88
> accel defaultsite=192.168.24.198
> acl all src 0.0.0.0/0.0.0.0
> http_access allow all
> cache_peer 192.168.24.198 parent 8088 0 no-query originserver
>
> When Clients access http://192.168.0.164:88/rdims/index.jsp
> HTTP request header which Squid sent to backend server is:
>
> GET /rdims/index.jsp HTTP/1.0
> Accept: */*
> Accept-Language: zh-cn
> UA-CPU: x86
> Accept-Encoding: gzip, deflate
> User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1;
.NET
> CLR 2.0.50727; InfoPath.1; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
> Host: 192.168.24.198
> Via: 1.1 szrd.com:88 (squid/2.6.STABLE21)
> X-Forwarded-For: 192.168.12.48
> Cache-Control: max-age=259200
> Connection: keep-alive
>
> My originserver port is 8088,Why HOST is 192.168.0.164, I think that the
> HOST should be 92.168.24.198:8080.

"accel defaultsite=192.168.24.198" by itself means...

... 'accelerate' the URL.
... use 192.168.24.198 as the Host: header content if no domain name
present (in the URL).

Client sent squid:
GET /rdims/index.jsp HTTP/1.0
Host: 192.168.0.164:88

... /rdims/index.jsp contains no domain name, so the
defaultsite=192.168.24.198 set "Host: 192.168.24.198"

>
> I alter HTTP_Port as follow:
> http_port 192.168.0.164:88 accel vhost defaultsite=192.168.24.198 vport
> When Clients access http://192.168.0.164:88/rdims/index.jsp
> HTTP request header which Squid sent to backend server is:
>
> GET /rdims/index.jsp HTTP/1.0
> Accept: */*
> Accept-Language: zh-cn
> UA-CPU: x86
> Accept-Encoding: gzip, deflate
> User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1;
.NET
> CLR 2.0.50727; InfoPath.1; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
> Host: 192.168.24.198:88
> Via: 1.1 szrd.com:88 (squid/2.6.STABLE21)
> X-Forwarded-For: 192.168.12.48
> Cache-Control: max-age=259200
> Connection: keep-alive
>
> Now why the Host is 192.168.0.164:88?

"accel vhost defaultsite=192.168.24.198 vport" means ...

... 'accelerate' the URL.
... (vhost) use client-given Host: header when available.
... (vport) use the client-given Host: HTTP port (default the peers
listening port if none found).
... (defaultsite=) use 192.168.24.198 if neither of the above give a usable
domain/IP.

The client sends:

Client sent squid:
GET /rdims/index.jsp HTTP/1.0
Host: 192.168.0.164:88

So Squid check the URL. Finds /rdims/index.jsp.
... checks the Host: header. Finds 192.168.0.164:88, making
URL=http://192.168.0.164:88/rdims/index.jsp
... checks the Host: header port. Finds 88, making
URL=http://192.168.0.164:88/rdims/index.jsp
... has a domain '192.168.0.164', so skips defaultsite

And passes on:
GET /rdims/index.jsp HTTP/1.0
Host: 192.168.0.164:88

>
> I alter HTTP_Port again: http_port 192.168.0.164:88 accel vhost
> defaultsite=192.168.24.198 vport=8088
> When Clients access http://192.168.0.164:88/rdims/index.jsp
> HTTP request header which Squid sent to backend server is:
>
> GET /rdims/index.jsp HTTP/1.0
> Accept: */*
> Accept-Language: zh-cn
> UA-CPU: x86
> Accept-Encoding: gzip, deflate
> User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1;
.NET
> CLR 2.0.50727; InfoPath.1; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
> Host: 192.168.24.198
> Via: 1.1 szrd.com:88 (squid/2.6.STABLE21)
> X-Forwarded-For: 192.168.12.48
> Cache-Control: max-age=259200
> Connection: keep-alive
>
> Why the host is 192.168.0.164:88?

? its not.

> I think that the HOST should be
> 92.168.24.198:8088.

"accel vhost defaultsite=192.168.24.198 vport=8080" means ...

... 'accelerate' the URL.
... (vhost) use client-given Host: header when available.
... (vport=) use the client-given Host: HTTP port (default 8088 if none
found).
... (defaultsite=) use 192.168.24.198 if neither of the above give a usable
domain/IP.

So Squid check the URL. Finds /rdims/index.jsp.
... checks the Host: header. Finds 192.168.0.164:88, making
URL=http://192.168.0.164:88/rdims/index.jsp
... checks the Host: header port. Finds 88, making
URL=http://192.168.0.164:88/rdims/index.jsp
... has a domain '192.168.0.164', so skips defaultsite

I think it should have been: "Host: 192.168.0.164:88" maybe something went
wrong and caused defaultsite to be used. Henrik might know.

> At last the vport must be used with vhost?

I don't think so.

Amos
Received on Tue Sep 29 2009 - 04:51:58 MDT

This archive was generated by hypermail 2.2.0 : Tue Sep 29 2009 - 12:00:03 MDT