Re: [squid-users] time acl, domain acl and always direct

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Thu, 13 Sep 2012 11:55:42 +1200

On 12.09.2012 20:22, Benjamin Joseph Dag wrote:
> Hi I am a beginner squid user running Squid 2.7 on Windows NT
>
> I am trying to have certain domains go directly to the server on a
> specific time range and days..
>
> could someone help me with the squid.conf?
>
> domain: Youtube site and cache
> time range to be direct connect to the net: 8am to 5pm
> time range to go through parent proxy: 5:01pm-7:59am
>
> setup: proxy pc has own internet connection with limited bandwidth
> uses parent proxy for most of the domains except those which are not
> allowed during work hours (8am-5pm) e.g youtube, google video, vimeo
>
> what I want to do is that those sites that are blocked on the parent
> proxy go through the machine's internet connection during work hours
> ,
> and then the rest of the day they go through the parent proxy
>
> thanks!

Define a time ACL for the work hours. ACL can be multiple lines like
so:
   acl workHours time MTWHF 9:00-11:59
   acl workHours time MTWHF 13:00-4:59

A dstdomain ACL for the sites like so:
  acl mediaSites dstdomain ...

then add cache_peer_access rules to DENY access to the parent proxy
outside those hours:
   cache_peer_access ... deny !workHours mediaSites
   always_direct allow !workHours mediaSites

The tricky part is getting it in the right order in relation to all
your other rules. Putting it above the other cache_peer_access rules
should be fine.

Note that time only matches *new* requests, so a video started seconds
outside workHours times will continue to run until it stops.

Amos
Received on Wed Sep 12 2012 - 23:55:47 MDT

This archive was generated by hypermail 2.2.0 : Thu Sep 13 2012 - 12:00:03 MDT