运行ha-proxy 1.6。
有人可以告诉我为什么ACL和HTTP请求拒绝不工作?
我试过模式http,模式TCP,结束斜线,path中没有斜线,一个path_end,不同的networking掩码,一个单一的IP等,我不能得到它的工作。 没有访问控制。 我可以从任何地方到达目录和文件。
global pidfile /var/run/haproxy.pid daemon defaults mode tcp retries 5 option redispatch option dontlognull option tcp-smart-accept option tcp-smart-connect listen front-end bind xxx.xxx.xxx.xx1:80 bind xxx.xxx.xxx.xx2:80 mode http balance roundrobin option forceclose option http-server-close option forwardfor maxconn 2000 timeout http-request 15s timeout connect 15s timeout server 60s timeout client 30s timeout http-keep-alive 15s acl network_allowed src xxx.xxx.xxx.xx5 acl inside path_beg,url_dec -i /path/to/directory/ http-request deny if inside !network_allowed server 1 xxx.xxx.xxx.xx1:80 weight 10 SERVER1 check server 2 xxx.xxx.xxx.xx2:80 weight 10 SERVER2 check server 3 xxx.xxx.xxx.xx3:80 weight 15 SERVER3 check
尝试添加-m beg
:
acl inside path_beg,url_dec -m beg -i /path/to/directory/
另外,你正在努力实现什么?
正如我可以在我的服务器上看到并validation你的:现在从src xxx.xxx.xxx.xx5
你可以访问所有的东西,而从其他地址你将得到403
/path/to/directory
:
curl http://example.com/path/to/directory/ <html><body><h1>403 Forbidden</h1> Request forbidden by administrative rules. </body></html>
但是,如果你添加OR
你的http-request deny
:
http-request deny if inside OR !network_allowed
那么你将从除了src xxx.xxx.xxx.xx5
之外的所有地址得到403
,并且从这个地址你将得到403
给/path/to/directory
哪一种行为是对的?