Search squid archive

Re: url_regex help

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

 



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

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

  Powered by Linux