【问题标题】:HAProxy: Backend with subdirectory / subpath / subfolder?HAProxy:带有子目录/子路径/子文件夹的后端?
【发布时间】:2014-04-08 19:02:31
【问题描述】:

我正在努力实现这一目标:

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

这样请求就会被这样处理:

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

我该怎么做?谢谢。

【问题讨论】:

    标签: backend subdirectory haproxy


    【解决方案1】:

    您可以通过以下配置实现此"http://front-end/app-2/do-that --> http://back-end/app-2-another-path/do-that":

    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 是关于 reqirep 的更多信息。

    【讨论】:

      猜你喜欢
      • 2014-02-15
      • 2019-01-07
      • 2017-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-16
      • 1970-01-01
      相关资源
      最近更新 更多