Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm investigating HAProxy as a possible replacement for F5. F5 is capable of persisting a session based on a response header value:

  set session [HTTP::header X-Session]
  if {$session ne ""} {
    persist add uie $session

and then route all subsequent requests which contain the same session ID in a header, query parameter, path, etc. to the same machine, eg:

  set session [findstr [HTTP::path] "/session/" 9 /]
  if {$session} {
    persist uie $session

I'm wondering if this is even possible to do with HAProxy?

share|improve this question
up vote 3 down vote accepted

HAProxy 1.5 (the current development version) implements stickiness on response with the stick store-response command. The command would be like this:

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"

Disclaimer: the above is based on reading the docs, not tested on an actual HAProxy installation.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.