Load-Balancing
HAProxy:可能由響應標頭觸發的會話粘性?
我正在研究 HAProxy 作為 F5 的可能替代品。F5 能夠根據響應標頭值保持會話:
when HTTP_RESPONSE { set session [HTTP::header X-Session] if {$session ne ""} { persist add uie $session } }
然後將所有在標頭、查詢參數、路徑等中包含相同會話 ID 的後續請求路由到同一台機器,例如:
when HTTP_REQUEST { set session [findstr [HTTP::path] "/session/" 9 /] if {$session} { persist uie $session } }
我想知道這是否可能與HAProxy有關?
HAProxy 1.5(目前開發版本)實現了對
stick store-response
命令響應的粘性。該命令將是這樣的:stick store-response hdr(X-Session) stick on url-param(session) # the session ID is in a query parameter # if the session ID is in the path, like /session/{session ID}/doSomething # in this case, the X-Session header value probably has to be the format "/session/{session ID}" # and the session ID length has to be fixed stick on path {session ID + path prefix length, including slashes} if path_beg "/session"
免責聲明:以上內容基於閱讀文件,未經實際 HAProxy 安裝測試。