haproxy remove trailing slash

扶醉桌前 提交于 2019-12-21 22:00:49

问题


I would like to redirect request from:

http://myrepo/mytest.git/

to

http://myrepo/mytest.git

so, removing the trailing slash in haproxy. any hint ?

Here's what I tried both in frontend and backend:

 reqrep ^(.*)[\/]$ \1

回答1:


you can try like this.

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


来源:https://stackoverflow.com/questions/29640934/haproxy-remove-trailing-slash

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!