Re: [squid-users] url rewrite problem

From: Keshava M P <keshava.mp@dont-contact.us>
Date: Tue, 2 Oct 2007 12:51:28 +0530

you have to use a redirector and you have to include the
url_rewrite_program and related directives in squid.conf. typicallly,
url_rewrite_program=/path/to/yourredirectprogram/
url_rewrite_children=5
url_rewrite_concurrency=5
url_rewrite_host_header off

Either you define the entries of internal hosts in /etc/hosts or you
can use the internal ips directly in your redirector.
example: your outside ip is mapped to e1.yourdomain.com,
e2.yourdomain.com,e3.yourdomain.com.
let us say these correspond to host1 (10.9.0.1), host2 (10.9.0.2),
host3 (10.9.0.3)

your redirector program will look something like this:

#!/usr/bin/perl
$|=1;
while (<>) {
    @X = split;
    $url = $X[0];
    $url =~ s@http://e1.yourdomain.com@http://host1@i;
    $url =~ s@http://e2.yourdomain.com@http://host2@i;
    $url =~ s@http://e3.yourdomain.com@http://host3@i;
    print;
}

you can also use internal ip addresses in place of host1, host2 etc.
you can even redirect to a specific page like
http://host1/path/to/your/page

Keshava

On 10/2/07, Srinivas B <b.srinivas231@gmail.com> wrote:
> Hi All,
>
> is there any way I can redirect urls that are replaced by accelerated mode.
>
> I have something like
>
> http_port 8080 accel defaultsite=mysite.com
>
> Requests are replaced by host=mysite.com.
>
> I want to redirect some url based on original request (depending upon
> hostname). I have tried vhost option.., but doesn't seem to solve the
> problem, as hostname requested externally is not defined in internal
> DNS.
>
> Please help
>
> Thanks in advance.
>
> Srinivas
>

-- 
M P Keshava
Received on Tue Oct 02 2007 - 01:21:34 MDT

This archive was generated by hypermail pre-2.1.9 : Thu Nov 01 2007 - 13:00:00 MDT