Re: Add more ports on Web accelerator

From: C W CHAN <[email protected]>
Date: Thu, 27 Jan 2000 11:25:29 +0800

Hi,

I have already setup the "httpd_accel_uses_host_header" to on and added the resolve for
"Intra-adm" to "accelerator". In my case, I want to forward the port 80 to another web
server's adm port 8083 throught the accelerator.

                                        80 8083
www.domain.edu.hk ----------> accelerator -----------> intra-adm.domain.edu.hk

I have followed the contribution in the Squid src to create the redirector. Is there any
mistake in the redirector?

#!/usr/bin/perl -T -w
#
# rredir.pl
#
# Author: Peter Eisenhauer <pe@pipetronix.de>
# First Version: 26. May 1997
#
# Description: Direct all request to files who are in a local dir to
# this directory
#
use File::Basename;
use URI::URL;

# customization part

# Local Domainame from which no redirects should be done
$localdomain = 'domain.edu.hk';
# Local domainame qouted for regexps
$regexlocaldomain = quotemeta($localdomain);
# Path under which the scripts accesses the local dir (must end with /)
#$access_local_dir='/opt/utils/etc/httpd/htdocs/local-rredir/';
# Information for the redirected URL (redirect_path must end with /)
$redirect_scheme = 'http';
$redirect_host = 'intra-adm.domain.edu.hk:8083';

# end of customization part

# flush after every print
$| = 1;

# Process lines of the form 'URL ip-address/fqdn ident method'
# See release notes of Squid 1.1 for details
while ( <> ) {
    ($url, $addr, $fqdn, $ident, $method) = m:(\S*) (\S*)/(\S*) (\S*) (\S*):;

    $url = url $url;
    $host = lc($url->host);

    # do not process hosts in local domain or unqualified hostnames
    if ( $host =~ /$regexlocaldomain/ || $host !~ /\./ ) {
        next;
    }

    # just the file, without any host or path parts
    # and just in case: lowercase the file name, so you should make sure
    # all the files in the local dir are only lowercase !!

    # look if in local dir, if yes redirect
    }
    if ( $url eq "www.domain.edu.hk" ) {
        $url->scheme($redirect_scheme);
        $url->host($redirect_host);
    }

} continue {
    print "$url $addr/$fqdn $ident $method\n"
}

Henrik Nordstrom wrote:

> C W CHAN wrote:
>
> > I have setup the redirector perl script to my web accelerator to forward the users'
> > request as follows:
> >
> > host1.domain.com ----------> internal-host1.domain.com
> > adm-host1.domain.com ----------> internal-host1.domain.com:8083
> >
> > The first is OK but second is failed.
> > While the user tried to access the "adm-host1.domain.com", the redirector forwarded it
> > to "internal-host1.domain.com".
>
> Then you probably haven't made the redirector correctly, or haven't told
> Squid to care about domains (httpd_accel_uses_host_header on).
>
> > I knew the Squid (as reverse proxy) can listen more than one port
> > through the parameter of "http_port". Is it possible to support
> > multi ports at the same server?
>
> The accelerator will not differentiate between requests received on the
> different ports if that is what you are asking.
>
> --
> Henrik Nordstorm
> Squid hacker
Received on Thu Jan 27 2000 - 00:01:24 MST

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