haproxy删除结尾的斜杠 [英] haproxy remove trailing slash
本文介绍了haproxy删除结尾的斜杠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从以下位置重定向请求:
I would like to redirect request from:
http://myrepo/mytest.git/
到
http://myrepo/mytest.git
因此,请删除haproxy中的结尾斜杠.有什么提示吗?
so, removing the trailing slash in haproxy. any hint ?
这是我在前端和后端都尝试过的方法:
Here's what I tried both in frontend and backend:
reqrep ^(.*)[\/]$ \1
推荐答案
您可以尝试这样.
frontend nginx
bind *:5000
mode http
option forwardfor
option httpclose
acl old_url path_beg -i /mytest.git
reqrep ^(.*)[\ /]$ \1
redirect prefix / code 301 if old_url
default_backend tomcats
backend tomcats
mode http
server tomcat01 X.X.X.X:8080 check inter 2000
这篇关于haproxy删除结尾的斜杠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文