2016-09-20 66 views
0

使用HAProxy v1.6HAProxy的基於URL參數

我在做,目前(至少在JavaScript的)將不支持自定義頁眉的WebSocket請求添加頭。

我嘗試添加在HAProxy的層自定義標題基於GET參數

例(它轉發到負載均衡器前):

下一個代碼工作(在後臺)

#match get-url someGetKey paramater 
acl is_key_match  url_reg   \?(?:.*?)someGetKey=([\w|=]+) 
#Add header 
http-request set-header My-Custom-Header hardcoded_string if is_key_match 

我的目標是與第一場比賽組正則表達式\?(?:.*?)someGetKey=([\w|=]+)

是否有可能更換相應hardcoded_string

謝謝!

回答

0

找到了解決方案:

http-request set-header cookie %[urlp(SSession)] if is_sticky_url 

%[] - 變量
url(SSession) - 與密鑰SSession HTTP-GET參數