HAProxy: session stickiness triggered by response header possible?
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.