1:允许用户访问某些域名,我测试环境只写了一个;
[root@BJ-fastcache132 etc]# cat acl.txt s0.hao123img.com
测试环境:修改本地host文件,指定上面2个域名对应一个IP;
acl aclname dstdomain "/app/squid/etc/acl.txt" http_access allow aclname http_access deny all
2:允许用户访问png格式图片配置:
acl allow_sites urlpath_regex -i \.png$ http_access allow allow_sites http_access deny all
效果图:
官方文档介绍:
# # h1:m1 must be less than h2:m2
#
# acl aclname url_regex [-i] ^http:// ...
# # regex matching on whole URL [fast]
# acl aclname urllogin [-i] [^a-zA-Z0-9] ...
# # regex matching on URL login field
# acl aclname urlpath_regex [-i] \.gif$ ...
# # regex matching on URL path [fast]
#
转载于:https://blog.51cto.com/luyafei/1201334