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.s...@gmail.com] 
Sent: Friday, January 02, 2009 3:19 PM
To: Dean Weimer
Cc: squid-users@squid-cache.org
Subject: Re: [squid-users] url_regex help

On Fri, Jan 2, 2009 at 5:13 PM, Dean Weimer <dwei...@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

Reply via email to