Re: [squid-users] Squid redirection

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Thu, 25 Mar 2010 21:24:09 +1300

jayesh chavan wrote:
> Hi,
> I have written script which redirects my squid to local
> apache.It works fine for FOLLOWING SCRIPT
>
> #!c:/perl/bin/perl.exe
> $|=1;
> while (<>) {
> s@http://www.az.com@http://117.195.4.252@;
> print;
> }
>
> But whenever I use this script
> #!c:/perl/bin/perl.exe
> $|=1;
> while (<>) {
> s@http://www.az.com@http://117.195.4.252//index.html@;
> print;
> }
>
> It doesnt work.I observed that this is happening due to redirect
> program which is appending / at the end of rewritten url.It gives
> error as:
> The requested URL
> /index.html/ was not found on this server.
> How to avoid that?

  * Squid passes the URL whole to the script
  * The redirect script does exactly what you program into it.
  * Squid uses exactly what the script outputs.

Your web browser is requesting:

    http://www.az.com/

http://117.195.4.252/ is a valid URL at the receiving server which is
why the first one works.

If you were to request

   http://www.az.com/some.html

methinks that script will re-write it as:

   http://117.195.4.252//index.html/some.html

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE8 or 3.0.STABLE25
   Current Beta Squid 3.1.0.18
Received on Thu Mar 25 2010 - 08:24:21 MDT

This archive was generated by hypermail 2.2.0 : Thu Mar 25 2010 - 12:00:07 MDT