Re: [squid-users] Destination domain and regular expression

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Sat, 03 Jul 2010 00:09:37 +1200

Alberto Cappadonia wrote:
> Il 02/07/10 01.40, Amos Jeffries ha scritto:
>> Alberto Cappadonia wrote:
>>> Hi all,
>>>
>>> If I want to deny the access, for example, to google and I want that
>>> every
>>> google web site (in any language) cannot be accessed, can I write an
>>> acl
>>> like the following?
>>>
>>> ------
>>> acl googleDomains dstdom_regex -i .*\.google\..*
>>>
>>> http_access deny googleDomains
>>> ------
>>>
>>> or i have to use other acl like url_regex ?
>>
>> For that use yes dstdom_regex is appropriate.
>>
>> The .* at the start and end of the pattern can be removed.
>> Giving you:
>> acl googleDomains dstdom_regex -i \.google\.
>
> ok, thanks.
>
> But this means that Squid automatically adds .* at the start and at the
> end of the pattern?

Yes. This is regex standard behaviour. Not just in Squid.

There are special codes ^ and $ to mark the input start and end
(respectively) in regex if you require any pattern to match the start,
finish or entire input.

>
> this is valid for all the acls that support regex? (like ident_regex,
> url_regex, etc..)
>
> if I write:
>
> acl googleDomains dstdom_regex -i \.google.com
>
> is equivalent to .*\.google\.com.* ?

Yes.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.4
Received on Fri Jul 02 2010 - 12:09:46 MDT

This archive was generated by hypermail 2.2.0 : Fri Jul 02 2010 - 12:00:04 MDT