Kazuto Tominaga wrote:
> several web servers inside, I use a redirector to demultiplex
> requests by rewriting URL like this:
>
> http://www.squid.my.site/xlab/ -> http://www.xlab.my.site/
> http://www.squid.my.site/ylab/ -> http://www.ylab.my.site/
No you can't rewrite responces.
There exists two different ways to solve this, based on how you want
your servers to appear.
a) Acceleration setup for multiple independent servers, each supporting
any number of virtual servers.
b) Acceleration of multiple servers handling different parts of the web
contents. All should appear as one single big server. (this is your
setup)
In both cases it is important that you don't rewrite the path in the
URL. It is only allowed to rewrite the host part, and only to find the
correct server internal. The internal server needs to have the same
visible server name as the official (external) name, or redirects will
fail.
############ setup A ################
# Multiple independent servers #
#####################################
* The squid needs as many external IP addresses as you have internal
WWW-server IP addresses.
* Both http_accel virtual and http_accel_uses_host_header enabled (may
require a small patch to Squid to make this possible, see the archive)
* The internal names on the servers are the same as the external
(accelerated). Use a split DNS setup to archeive this..
* Use a redirector to rewrite external IP addresses to the real host
names, to handle requests without Host: header.
You should not use a redirector to rewrite the URL, only to correct it
when Squid doesn't know what the URL was (no Host: header).
If you don't use pure virtual servers (many servers sharing one IP) on
your internal machines, then you don't need http_accel_uses_host_header
(or the patch that may be required to combine http_accel virtual and
http_accel_uses_host_header).
Example:
3 internal web servers, on two machines (one pure virtual server).
www1.my.site on serverA 192.168.1.2
www2.my.site on serverB 192.168.1.3
www3.my.site on serverB 192.168.1.3 (this is a virtual WWW server)
The internal DNS contains the same information.
serverA IN A 192.168.1.2
serverB IN A 192.168.1.3
www1 IN CNAME serverA
www2 IN CNAME serverB
www3 IN CNAME serverB
Remember to configure the visible hostname on each WWW server to the
www-server name (www1.my.site, www2.my.site, ...)
External configuration (xxx.yyy.zzz == external network)
www1.my.site on squid xxx.yyy.zzz.44
www2.my.site on squid xxx.yyy.zzz.45
www3.my.site on squid xxx.yyy.zzz.45
Note that two IP addresses are used. Mosts OS:es support virtual IP
interfaces so this should not pose any technical problem.
The squid machine uses the internal DNS to resolve names, so that when
it looks for the machine www1.company.com it gets the internal server
and not itself.
You then need a redirector, to rewrite
xxx.yyy.zzz.44 -> www1.my.site
xxx.yyy.zzz.45 -> www2.my.site
(to support requests without Host: header)
External DNS:
www1 IN A xxx.yyy.zzz.44
www2 IN A xxx.yyy.zzz.45
www3 IN CNAME www2
or
www3 IN A xxx.yyy.zzz.45
If you don't care about clients not sending a Host: header, then you can
use one single external IP, and use http_accel www1.your.site 80 instead
of http_accel virtual... (you do need http_accel_uses_host_header in all
caces). Clients not sending a Host: header can only reach www1.your.site
in this setup.
############################################
# Setup B, Many servers acting as one big #
############################################
Use a path prefix on all internal servers as well as in the accelerator,
and use the same visible server name on all the server. Then use a
redirector to rewrite only the hostname correct internal server where
the local site is located.
Visible server name: www.my.site (this points to the accelerator)
Internal servers: www.xlab.my.site, www.ylab.my.site,... each with
visible www server name set to www.my.site, and the contents in a sub
directory named after the local site (xlab, ylab,...)
Then use a redirector rewrite
http://..../xlab/ -> http://www.xlab.my.site/xlab/
http://..../ylab/ -> http://www.ylab.my.site/ylab/
....
--- Hemrik Nordström Sparetime Squid HackerReceived on Thu Jan 08 1998 - 16:04:52 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:38:21 MST