Search squid archive

Re: url_rewriter problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Carlos Martínez-Troncoso C. wrote:
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

You will get faster results reversing the above two lines.
As chris said for wildcarding the *.ezproxy.uninorte.edu.co sub-domains use "dstdomain .ezproxy.uninorte.edu.co" instead of the regex.


url_rewrite_access deny all
url_rewrite_children 50

Concurrency is faster than children, with less system resource usage.

When you have it going, you should consider making your script accept a small integer token as the first input value, and write it out unchanged in same position with the result.
That lets you use: url_rewrite_concurrency N

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.


Amos
--
Please be using
  Current Stable Squid 2.7.STABLE6 or 3.0.STABLE13
  Current Beta Squid 3.1.0.5

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux