[squid-users] Confusing redirection behaviour

From: Dave Coventry <dgcoventry@dont-contact.us>
Date: Mon, 17 Mar 2008 14:23:34 +0200

In an attempt to generate a login page I was previously using
"external_acl_type" to define a helper program to define my acl, and
then using "deny_info" to define a logon page for my users.

This failed because the redirected page did not appear to use it's own
URL as it's root and instead substituted the requested URL.

This meant that I was unable to call a CGI from my logon form because
the form's CGI was appended to the originally requested (and denied)
URL. So, if the user requested "toyota.co.za", and was (correctly)
sent to my login "192.168.60.254/login.html", the CGI called from the
login page's form was "toyota.co.za/cgi-bin/myperlscript.cgi".

Amos suggested that, instead of hosting the cgi script on the server,
I placed it on the 'net, but I'm afraid this wouldn't suit my purpose.

In desperation I'm looking at "url_rewrite_program", but it also
appears to have redirection issues.

If I use the Perl script below, I would expect the requested URL to be
replaced by http://localhost/login.html, whatever the user requested.

However 2 results occur. If the requested URL is a simple tld, like
http://www.toyota.co.za, then the user is redirected to the Apache
default page which simply proclaims (misleadingly!) that "It Works!".
This in spite of the fact that the default page has been removed and
replaced.

If the URL takes the form
"http://www.google.co.za/firefox?client=firefox-a&rls=org.mozilla:en-GB:official"
then the user is presented with a 404 which says "firefox not found".
/var/log/apache/error.log confirms that "/var/www/firefox" is not
found.

This behaviour persists if I replace http://localhost with
http://192.168.60.254 or with http://news.bbc.co.uk, or whatever.

#!/usr/bin/perl
$|=1;
while (<>) {
    @X = split;
    $url = $X[0];
    $ip = $X[1];
    if (1 == 1){
        print "302:http://localhost/login.html\n";
    }
    else{
        print "$url\n";
    }
}
Received on Mon Mar 17 2008 - 06:23:39 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Apr 01 2008 - 13:00:05 MDT