[SQU] Reverse proxy multiple targets

From: Kailou Anassara <[email protected]>
Date: Thu, 7 Sep 2000 12:24:39 -0700

   I am a newbie to Squid and proxying. I have scoured the archives
(and continue to search) over the last day or 2 and have not found
exactly what I need. I've found pieces, but not the complete
picture. I want to run a Squid that will act as a forwarding agent
for multiple targets. It's nice if it will cache for the targets
also, but not necessary. The key function is forwarding to the
target host. I have setup Squid on a Solaris 2.5.1 box and I have
configured so that it can handle a single target - even got it to
perform that function with several different types of configurations
- but can't get it to quite do what I need for multiple targets.

A user needs to be able to enter the address of the Squid URL in the
browser and then the Squid needs to be able to determine where to
forward to based on the request. E.g.:
Squid -> x.x.x.x
target1 -> a.a.a.a
target2 -> b.b.b.b
target3 -> c.c.c.c

user sends: http://x.x.x.x/a?
(where a? is something that identifies that the request is for target a.a.a.a)
Squid sends to a.a.a.a

user sends: http://x.x.x.x/b?
Squid sends to b.b.b.b

The Squid does NOT proxy ALL http requests for the user, so the user
must explicitly address the Squid. Otherwise I'd just have the Squid
listen for a.a.a.a, b.b.b.b etc. I'm guessing I need to do something
with the 'redirect_program' and 'httpd_accel_uses_host_header on'. I
think this way I can analyze headers and grab identifying pieces that
tell me which target to forward to. That's where I get lost. What
should the user send in his URL and how do I grab that in my PERL
program? This simple redirect.pl does not quite do the trick:
#!/usr/bin/perl -p
BEGIN { $|=1; }
s%http://squid.domain.com/target1%http://target1.domain.com% && next;
s%http://squid.domain.com/target2%http://target2.domain.com% && next;

This will rewrite the address for me and serve my initial page
request, but any links on the requested page are lost since the
header no longer addresses the Squid.

I hope this makes sense. The solution seems like it should be
simple, but eludes me.

Any help is appreciated.

-Kailou

--
To unsubscribe, see http://www.squid-cache.org/mailing-lists.html
Received on Thu Sep 07 2000 - 13:33:08 MDT

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