Re: [SQU] Reverse proxy multiple targets

From: C. Regis Wilson <t_pascal@dont-contact.us>
Date: Thu, 7 Sep 2000 13:20:50 -0700

>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
>
I don't think Squid will do it, although I did see some piece of a redirector
in the documentation and the squid.conf file. I used Apache
(http://www.apache.org) in conjunction with Squid. Check out the ProxyPass
function in Apache (http://www.apache.org/docs/mod/mod_proxy.html#proxypass)
and you'll see the powerful redirection abilities. Remember to compile
in proxy support (it's not there by default). It's a duplication of effort,
but it's a winning combination over here.

So, then, to use caching I just ran a Squid accelerator on port 80, aimed
at my Apache redirector at port 8080. Change the ports to suit your taste.
Squid would probably have to be in transparent mode for it to work for you,
however. Hope that helps.
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
--
To unsubscribe, see http://www.squid-cache.org/mailing-lists.html
Received on Thu Sep 07 2000 - 14:24:30 MDT

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