[squid-users] url_rewriter problem

From: Carlos Martínez-Troncoso C. <cmartinez_at_uninorte.edu.co>
Date: Fri, 20 Feb 2009 12:17:35 -0500

Hello Squid gurus.

I am having this problem with url_rewriter:

Squid Version:
 
Squid Cache: Version 3.0.STABLE7
configure options: '--build=i686-redhat-linux-gnu'
'--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu'
'--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr'
'--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
'--includedir=/usr/include' '--libdir=/usr/lib'
'--libexecdir=/usr/libexec' '--sharedstatedir=/usr/com'
'--mandir=/usr/share/man' '--infodir=/usr/share/info'
'--exec_prefix=/usr' '--bindir=/usr/sbin' '--libexecdir=/usr/lib/squid'
'--localstatedir=/var' '--datadir=/usr/share' '--sysconfdir=/etc/squid'
'--disable-dependency-tracking' '--enable-arp-acl'
'--enable-auth=basic,digest,ntlm,negotiate'
'--enable-basic-auth-helpers=LDAP,MSNT,NCSA,PAM,SMB,YP,getpwnam,multi-domain-NTLM,SASL'
'--enable-negotiate-auth-helpers=squid_kerb_auth'
'--enable-cache-digests' '--enable-cachemgr-hostname=localhost'
'--enable-delay-pools' '--enable-digest-auth-helpers=password'
'--enable-epoll'
'--enable-external-acl-helpers=ip_user,ldap_group,unix_group,wbinfo_group'
'--enable-icap-client' '--enable-ident-lookups' '--with-large-files'
'--enable-linux-netfilter' '--enable-ntlm-auth-helpers=SMB,fakeauth'
'--enable-referer-log' '--enable-removal-policies=heap,lru'
'--enable-snmp' '--enable-ssl'
'--enable-storeio=aufs,coss,diskd,null,ufs' '--enable-useragent-log'
'--enable-wccpv2' '--with-aio' '--with-default-user=squid'
'--with-filedescriptors=65536' '--with-dl'
'--with-openssl=/usr/kerberos' '--with-pthreads'
'build_alias=i686-redhat-linux-gnu' 'host_alias=i686-redhat-linux-gnu'
'target_alias=i386-redhat-linux-gnu' 'CFLAGS=-fPIE -Os -g -pipe
-fsigned-char -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386
-mtune=generic -fasynchronous-unwind-tables' 'LDFLAGS=-pie'
'CXXFLAGS=-fPIE -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386
-mtune=generic -fasynchronous-unwind-tables' 'FFLAGS=-O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables'

We want to rewrite all URLS going to ezproxy.uninorte.edu.co, for
example
http://ezproxy.uninorte.edu.co:2048/login?url=http://search.eb.com/ must
be rewritten to http://search.eb.com/ (the URL always starts with
http://ezproxy.uninorte.edu.co:2048/login?url=)

We wrote this script in PERL:

#!/usr/bin/perl -wl
$|=1;
while (<>)
{
  @X = split (/=/);
  $url = $X[0];
  if ($url =~ /^http:\/\/ezproxy\.uninorte\.edu\.co:2048/) {
    $url = $X[1];
    print "$url\n";
  }else {
    print "$url\n"; }
}

In squid.conf I configured (I tried with url_regex only, then with
dstdomain only, this the "final version"):

acl url_ezproxy url_regex -i ezproxy.uninorte.edu.co*
acl rw dstdomain ezproxy.uninorte.edu.co
url_rewrite_access allow url_ezproxy
url_rewrite_access allow rw
url_rewrite_access deny all
url_rewrite_children 50
url_rewrite_program /etc/squid/redirector/ezproxy.pl

When i test to access a URL starting with exproxy... (the browser is
configured to pass all by a proxy) the URL is not rewritten. I tested
the PERL script in a command line and it works, the permissions are 770,
owner squid.squid.

I looked in the logs but the URL writer is not working, I suspect my
url_rewrite_access is bad, but I looked in the docs and it seems it´s ok.

What can I do? What is the error?

Thanks in advance.

-- 
Ing. Carlos Martínez-Troncoso Cera
Administrador de Servicios Internet y Correo Institucional
Universidad del Norte - www.uninorte.edu.co
Tel: 57 5 3509367
Barranquilla, Colombia
Received on Fri Feb 20 2009 - 17:17:49 MST

This archive was generated by hypermail 2.2.0 : Sat Feb 21 2009 - 12:00:02 MST