2014-03-06 84 views
5

我試圖做到這一點:HAProxy:後端與子目錄/子路徑/子文件夾?

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 

我怎樣才能做到這一點?謝謝。

回答

11

您可以通過以下配置實現這一"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 

Herereqirep更多信息。