【发布时间】:2019-01-25 19:23:13
【问题描述】:
haproxy 版本 1.5.18
我要重定向:
/document/(.*)/(.*)/somefile => /anotherPath/somefile
例如:重定向
/document/20181/20182/a_good_pic.jpg => /anotherPath/a_good_pic.jpg
如何用 haproxy 做到这一点?
我重试了 reqirep 的示例,例如:
# replace "/static/" with "/" at the beginning of any request path.
reqrep ^([^\ :]*)\ /static/(.*) \1\ /\2
但我的示例在 URL 路径中有两个部分与示例不同,所以我很困惑。
谢谢!
【问题讨论】:
-
请不要将问题交叉发布到多个站点。 serverfault.com/q/950831/153161
-
您使用 HAProxy 1.5 有什么原因吗?它目前只接收关键补丁,而不是长期支持的一部分。使用 1.6 或更高版本将使您尝试做的事情变得更加容易。
-
是的,通常版本由IT人员决定,我们无权升级。
标签: path url-redirection haproxy