Method: RhaproxyKeywords#persist_rdp_cookie

Defined in:
lib/rhaproxy/keywords.rb

persist rdp-cookie persist rdp-cookie(name)

Enable RDP cookie-based persistence
May be used in sections :   defaults | frontend | listen | backend
                               yes   |    no    |   yes  |   yes
Arguments :
  <name>    is the optional name of the RDP cookie to check. If omitted, the
            default cookie name "msts" will be used. There currently is no
            valid reason to change this name.

This statement enables persistence based on an RDP cookie. The RDP cookie
contains all information required to find the server in the list of known
servers. So when this option is set in the backend, the request is analysed
and if an RDP cookie is found, it is decoded. If it matches a known server
which is still UP (or if "option persist" is set), then the connection is
forwarded to this server.

Note that this only makes sense in a TCP backend, but for this to work, the
frontend must have waited long enough to ensure that an RDP cookie is present
in the request buffer. This is the same requirement as with the "rdp-cookie"
load-balancing method. Thus it is highly recommended to put all statements in
a single "listen" section.

Also, it is important to understand that the terminal server will emit this
RDP cookie only if it is configured for "token redirection mode", which means
that the "IP address redirection" option is disabled.

Example :
      listen tse-farm
          bind :3389
          # wait up to 5s for an RDP cookie in the request
          tcp-request inspect-delay 5s
          tcp-request content accept if RDP_COOKIE
          # apply RDP cookie persistence
          persist rdp-cookie
          # if server is unknown, let's balance on the same cookie.

# alternatively, “balance leastconn” may be useful too.

          balance rdp-cookie
          server srv1 1.1.1.1:3389
          server srv2 1.1.1.2:3389

See also : "balance rdp-cookie", "tcp-request" and the "req_rdp_cookie" ACL.


5678
5679
5680
5681
5682
5683
5684
5685
# File 'lib/rhaproxy/keywords.rb', line 5678

def persist_rdp_cookie(params = nil)
  if @name_index
    @conf.insert(@name_index + @conf.length, "    " + "persist rdp-cookie " + params.to_s + "\n")
  else
    puts "no #{@proxy_type} name assigned"
    return false
  end
end