RE: [squid-users] url_regex help

From: Dean Weimer <dweimer_at_orscheln.com>
Date: Fri, 2 Jan 2009 15:46:45 -0600

That worked, thanks a lot, used your advice on a single rule instead of two as well.

Thanks,
     Dean Weimer
     Network Administrator
     Orscheln Management Co

-----Original Message-----
From: Guillaume Smet [mailto:guillaume.smet_at_gmail.com]
Sent: Friday, January 02, 2009 3:19 PM
To: Dean Weimer
Cc: squid-users_at_squid-cache.org
Subject: Re: [squid-users] url_regex help

On Fri, Jan 2, 2009 at 5:13 PM, Dean Weimer <dweimer_at_orscheln.com> wrote:
> Here's what I have, anyone have an idea where I went wrong
> I am Running Squid 3.0 Stable 9 on FreeBSD 6.2
> Acl NOCACHEPDF url_regex -i ^http://hostname.\*pdf$
> Acl NOCACHEXLS url_regex -i ^http://hostname.\*xls$
> No_cache deny NOCACHEPDF NOCACHEXLS
>
> I have used cat combined with awk and grep to check the pattern matching on the access logs with:
> Cat /usr/local/squid/var/logs/access.log | awk '{print $7}' | grep -e ^http://hostname.\*pdf$
> Cat /usr/local/squid/var/logs/access.log | awk '{print $7}' | grep -e ^http://hostname.\*xls$

The \ character before the * is only necessary to prevent your shell
from expanding the wildcard because you didn't use quotes to escape
your regexp.

In your Squid conf file, you just need:
acl NOCACHEPDF url_regex -i ^http://hostname.*pdf$
acl NOCACHEXLS url_regex -i ^http://hostname.*xls$

But if I were you, I'd use:
acl NOCACHEXLS url_regex -i ^http://hostname/.*\.xls$
acl NOCACHEPDF url_regex -i ^http://hostname/.*\.pdf$
which is more precise and more correct IMHO.

Or shorter:
acl NOCACHE url_regex -i ^http://hostname/.*\.(pdf|xls)$

-- 
Guillaume
Received on Fri Jan 02 2009 - 21:46:52 MST

This archive was generated by hypermail 2.2.0 : Sat Jan 03 2009 - 12:00:01 MST