【发布时间】:2015-09-08 00:04:21
【问题描述】:
我需要将所有网址重定向到不带斜杠的网址
例子:
http://www.example.com/education/ -> http://www.example.com/education
http://www.example.com/blah// -> http://www.example.com/blah
http://www.example.com/blah/blah/// -> http://www.example.com/blah/blah
这是我现在拥有的:
frontend localnodes
bind 127.0.0.1:80
acl has_trailing_slash path_end /
reqrep ^(.*)[\ /]$ \1
redirect prefix / code 301 if has_trailing_slash
参考:haproxy remove trailing slash
但这只是让浏览器进入一个 301 的重定向循环。我如何做到这一点?
【问题讨论】:
标签: regex load-balancing haproxy