在haproxy中有没有像Apache“拒绝从IP”?
您可以创build一个ACL,然后在匹配ACL时使用连接拒绝来在tcp级别丢弃IP:
acl bad_ip src 10.10.10.0 tcp-request connection reject if bad_ip
你也可以设置一个403后端,并把它们发送到那个,如果你想在HTTP层次上完成的话:
frontend foo ... acl bad_ip src 10.10.10.0 use_backend bad_guy if bad_ip ... backend bad_guy mode http errorfile 403 /etc/haproxy/errors/403.http
这些ACL可以非常灵活,并且可以使ACL在ACL中满足多个条件,或者必须满足操作中的多个ACL。 更多在http://haproxy.1wt.eu/download/1.5/doc/configuration.txt 。