Search squid archive

[squid-users] multiple vhosts problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I want the ability to reverse proxy multiple name-based vhosts on
multiple backend web servers. However I cannot seem to implement this as
squid is finding hits for pages on the backend servers but not
differentiating them on the Host: header. i.e. a request for the root
document on one vhost causes a HIT for the root document from another
vhost.

My setup: multiple name-based virtual hosts, physically hosted on
multiple backend web servers. All vhosts are spread across each backend
webserver.

vhost1 -> webserver1, webserver2, webserver3
vhost2 -> webserver1, webserver2, webserver3

The content to each web server is kept in sync. A request for any vhost
can be satisfied by any web server.

I've placed a squid in front of the web servers so that requests that
come into squid should be redirected off to any of the backend web
servers. These are handled by a simple perl redirector so that they
redirected to a random webserver, thus performing a simple form of load
balancing. However, having looked at the contents of files in the cache,
and set debugging mode to 33,10 so I can see all client side HIT
information, I get TCP_HIT and TCP_MEM_HIT sometimes when a request
like:

GET / HTTP/1.1
HOST: vhost1

gets redirected to webserver1, and matches a request that is the same
and was also on webserver1:

GET / HTTP/1.1
HOST: vhost2

but was for a different vhost. The cache files themselves seem to record
what URL was used to retrieve them, but in the form of what they were
redirected to, so an entry in the cache has this information:

http://webserver1/

so when a similar request gets redirected to webserver1 asking for / it
HITs it, even if the request was actually originally for a different
vhost. Should squid not be also recording what vhost the request was
for, and then only matching HITs for requests that match the same vhost
?

Perhaps it can do this and I need to implement my redirector differently ?

The relevant parts of my squid.conf are:
httpd_accel_host www.mysite.com
httpd_accel_port 80
httpd_accel_single_host off
httpd_accel_with_proxy off
httpd_accel_uses_host_header on

# redirector
redirect_program /usr/local/squid/bin/redir.pl
redirect_children 10
redirect_rewrites_host_header off

I've tried setting httpd_accel_host to virtual with no difference. I'm
also running squid with the -V option which is listed as "Virtual host
httpd-accelerator" but I cannot find any documentation as to what this
actually does.

My only other thought is to do away with the redirector and setup a
local name server to round robin DNS requests over the backend
webservers which will keep the URL the same.

Any suggestions ? Many thanks.

--
Michael Pye

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux