小编rau*_*fer的帖子

Haproxy:拒绝来自文件的用户代理流量

我正在尝试使用带有 -f 选项的 haproxy ACL 从文件中读取来拒绝来自特定用户代理的连接(通过匹配用户代理标头的子字符串)。但是它不起作用,它运行时好像忽略了配置。

有更多haproxy经验的人可以指出我缺少什么吗?或者关于如何调试这个 haproxy 配置的一些提示?

我正在运行 haproxy 1.4.18。

这是 haproxy.cfg 的摘录:

listen http 0.0.0.0:80
    acl abuser hdr_sub(user-agent) -f /etc/haproxy/abuser.lst
    tcp-request content reject if abuser
    mode http
    server www1 127.0.0.1:8080 maxconn 10000
Run Code Online (Sandbox Code Playgroud)

这是abuser.lst 文件的内容:

# annoying bots
annoyingbot1
annoyingbot2
Run Code Online (Sandbox Code Playgroud)

access-control-list blocking http-headers haproxy useragent

8
推荐指数
1
解决办法
1万
查看次数