HAProxy: Backend with subdirectory / subpath / subfolder?

萝らか妹 提交于 2019-11-29 09:40:31

问题


I am trying to achieve this:

http://front-end       --> http://back-end/app-1
http://front-end/app-2 --> http://back-end/app-2-another-path

So that requests will be handled this way:

http://front-end/do-this       --> http://back-end/app-1/do-this
http://front-end/app-2/do-that --> http://back-end/app-2-another-path/do-that

How can I do this? Thank you.


回答1:


You can achieve this "http://front-end/app-2/do-that --> http://back-end/app-2-another-path/do-that" with the following configuration:

frontend http   
   #match url ending with /xxxxx/do-that
   acl do-that path_end -i /app-2/do-that

   use_backend server1 if do-that

backend server1
   reqirep ^([^\ :]*)\ /app-2/(.*)     \1\ /app-2-another-path/\2
   server server 168.192.X.X

Here is more information on reqirep.



来源:https://stackoverflow.com/questions/22219479/haproxy-backend-with-subdirectory-subpath-subfolder

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