我试图通过HAProxy重写单个path。 没有适当的规则,目录页面(从IIS节点)返回404。 一旦添加规则,一分钟左右后,页面会返回504网关超时。
backend Example_Backend balance uri reqirep ^([^\ ]*)\ (.*)/directory/?[\ ] \1\ \2/target.asp\ server Server1 xxxxx4:80 weight 25 check fall 10 rise 2 maxconn 40 server Server2 xxxxx5:80 weight 25 check fall 10 rise 2 maxconn 40 server Server3 xxxxx6:80 weight 25 check fall 10 rise 2 maxconn 40 server Server4 xxxxx7:80 weight 25 check fall 10 rise 2 maxconn 40
我使用reqirep的方式有什么问题吗? 我已经testing了使用sed ,以确保它匹配正确的以下内容:
GET http://www.example.com/directory HTTP/1.1 GET http://www.example.com/directory/ HTTP/1.1
思考?
编辑:从testing/目录和/目录/
haproxy[25957]: xxx100:50941 [31/May/2011:14:53:24.836] Example_Frontend Example_Backend/Server4 77/0/3/-1/50083 504 194 - - sH-- 1/1/1/1/0 0/0 "GET /directory/ HTTP/1.1" haproxy[25957]: xxx100:50942 [31/May/2011:14:53:26.124] Example_Frontend Example_Backend/Server4 78/0/5/-1/50087 504 194 - - sH-- 0/0/0/0/0 0/0 "GET /directory HTTP/1.1"
来自HAProxy邮件列表的Cyril指出,正则expression式是从请求中删除HTTP / 1.1和HTTP / 1.0。 他build议以下(哪些工作):
reqirep ^([^\ ]*)\ (.*)/directory/?\ (.*) \1\ \2/target.asp\ \3