为什么我的 url_regex 无法过滤 squid.conf 中的 mp4 文件?

问题描述 投票:0回答:1

我正在为代理管理员研究鱿鱼。最近,我需要过滤来自squid代理的多媒体文件的访问。所以我把这个写在我的 squid.conf --

acl test_network src 100.70.224.0/23
http_access allow test_network

#acl media_url url_regex -i .*\.mp4$ .*\.mkv$ .*\.webm$
acl media_url url_regex -i ^http://.*\.mp4$
http_access deny media_url test_network

但不幸的是,我发现它不能工作,测试结果是--

vsa10995083:/tmp/eisen # curl -x "100.70.225.235:8080" -O "http://100.70.224.70/kitty_in_the_sun.mp4"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 36.3M  100 36.3M    0     0  1508k      0  0:00:24  0:00:24 --:--:-- 1558k

我试过了——

.mp4$ ,  .*\(?*)mp4$
... 都失败了,curl 测试总是可以下载那个 mp4 文件。 我不知道我的 squid.conf 有什么问题。请提供帮助。 非常感谢。

squid
1个回答
0
投票

哦。 测试后找到答案——是因为在“http_access deny media_url test_network”之前加上了“http_access allow test_network” 所以它首先被允许并覆盖“拒绝”规则。 那么如果 squid.conf 是这样的 --

acl test_network src 100.70.224.0/23

acl media_url url_regex -i \.mp4$ \.mkv$ \.webm$
http_access deny media_url test_network

http_access allow test_network

然后就OK了

© www.soinside.com 2019 - 2024. All rights reserved.