Re: Redirector rewrite rules and Jesred

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Mon, 21 Jun 1999 00:26:24 +0000

Ashley Drees wrote:

> I guess I was looking for confirmation about the redirector regex files
> and any help with config... I cannot really mess around with the system
> at the internet end of things.. but can mess with the internal servers.

The URL after redirection must be unique to each site name, or Squids
caching will go havoc (squid caches on the URL after redirection, not on
the requested URL). To do this you either have to mess with the local
host file, or your DNS. Which one you select is based on administrative
control, taste and preference. I prefer to mess with the local host
table as this eleminates the need of a redirector (the host table is the
redirector), but you can do equally well with a combination of backend
DNS names for each site combined with a redirector rewriting the
official names to the backend names, or with a split DNS setup where the
accelerator uses a different DNS than the public internet DNS.

Example setup using a backend DNS names:

Two web servers with main sites www.example.com and www2.example.com
Two virtual sites (one on each): virtual1.example.com and
virtual2.example.com

Public DNS entries without acceleration

www.example.com. A 10.1.1.1
www2.example.com. A 10.1.1.2
virtual1.example.com. CNAME www.example.com.
virtual2.example.com. CNAME www2.example.com.

Accelerator introduced with DNS redirection table

accelerator.example.com. A 192.168.1.3
www.example.com. CNAME accelerator.example.com.
www2.example.com. CNAME accelerator.example.com.
virtual1.example.com. CNAME accelerator.example.com.
virtual2.example.com. CNAME accelerator.example.com.
internal-www.example.com. A 10.1.1.1
internal-www2.example.com. A 10.1.1.2
internal-virtual1.example.com. CNAME internal-www.example.com.
internal-virtual2.example.com. CNAME internal-www2.example.com.

---- redirector script -----
#!/usr/bin/perl -p
$|=1;
s%http://%http://internal-%;
-----------------------------

(you can of course use any 1-1 mapping you like for public and backend
names, but it needs to be a 1-1 mapping. The redirector needs to be
adjusted accordingly)

---- squid.conf ----
http_port 80
icp_port 0
httpd_accel_host www.example.com
httpd_accel_uses_host_header on
acl myservers dst internal-www.example.com internal-www2.example.com
acl port80 port 80
acl all dst 0.0.0.0/0
http_access myservers port80
http_access deny all
redirect_program /usr/local/squid/bin/redirect-internal.pl
redirect_rewrites_host_header off
cache_dir ...
---------------------

The web servers should be configured as if the accelerator wasn't there,
if possible.

If you need to support more than one true domain (IP based domain) to
the clients then things get somewhat more complicated. The accelerator
needs to have one IP address for each true domain, squid.conf configured
with "httpd_accel_host virtual", and the redirector needs to rewrite
these accelerator IP addresses to the backend main server names, or IP
addresses.

--
Henrik Nordstrom
Received on Sun Jun 20 1999 - 18:19:53 MDT

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