Re: Redirector rewrite rules and Jesred

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sun, 20 Jun 1999 17:15:19 +0000

Ashley Drees wrote:

> When I do not use the squid accelerator the virtual hosts work, when I use the
> accelerator i only get the default page on the virtual host server... I have
> only tried this running against the apache server to date.

> I fear that I have the regexi statement wrong...
>
> regexi ^http://virtual.host.add http://server.add ^http://virtual.

To accelerate virtual domains two things are required:

1. httpd_accel_uses_host_header on
2. Unique backend domainnames for each accelerated domain.

My recommendation is to have the real addresses of the servers in the
local host table instead of using a redirector to redirect the requests
to the backend servers.

Example:

virtual.example.com is a virtual domain on www.example.com

www.example.com server has the IP address 192.168.1.1
The accerator has the IP address 10.1.1.1

The official DNS then contains
virtual.example.com CNAME www.domain.com.
www.example.com A 10.1.1.1

Accelerator machines local host table contains:
192.168.1.1 www.example.com virtual.example.com www
(and /etc/nsswitch.conf says "hosts: files dns")

And squid.conf reads

httpd_accel_host www.example.com
httpd_accel_uses_host_header on
acl ourservers dst www.example.com
acl port80 port 80
acl all 0.0.0.0/0
http_access allow ourservers port80
http_access deny all
cache_dir ....

If you'd like to be able to accelerate multiple real domains (not
relying on the Host header) then you need to configure the accelerator
with one IP address for each real domain, and use a redirector to
rewrite from this accelerator IP address to the real domain name. Note
that the relationship between the accelerators real domains and the
backend servers read/virtual domains does not need to be a 1-1
relationship (the accelerator may turn virtual domains into real domains
or the rewerse, all depending on your configuration).

If you do not need more than one real domain (the amount of old clients
not supporting virtual domains is quite low today) then the above
configuration is sufficient.

If using a local host table isn't an option then set up backend server
DNS aliases for each domain accelerated, and have a redirector rewriting
the official names to the backend names. You should also use
"redirect_rewrites_host_header off" in this configuration, and have the
backend servers configured with the official domainnames (not the
backend alias names).

--
Henrik Nordstrom
Spare time Squid hacker
Received on Sun Jun 20 1999 - 11:03:48 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:46:56 MST