You need to load-balance Microsoft Terminal Services or remoteapps.
Both of them use the RDP protocol.

One main issue when using RDP is to be able to stick a user to a server.
The configuration below shows you how you can build outage-free Terminal server infrastructure thanks to the Aloha and HAProxy.


The TSE infrasctructure looks like the image below:
rdp infrastructure

Basically, we have a couple of Aloha load-balancer, in active/passive mode.
The Alohas share a VIP,, on which clients will get connected. In order to ensure stickiness, the Alohas will use the RDP cookie, store it in a table where it is associated to the server serving the request.
Finally, this table is shared between both Alohas, in order to ensure safe failover.


find below the configuration for such infrastructure:
[sourcecode language=”text”]
peers aloha
peer aloha1
peer aloha2

# RDP / TSE configuration
frontend ft_rdp
mode tcp
bind name rdp
timeout client 1h
option tcpka
option tcplog
log global
# wait up to 5s for an RDP cookie in the request
tcp-request inspect-delay 5s
tcp-request content accept if RDP_COOKIE
default_backend bk_rdp

backend bk_rdp
mode tcp
balance rdp-cookie
persist rdp-cookie

# Options
timeout server 1h
timeout connect 4s
option redispatch
option tcpka
option tcplog
log global

# sticky persistence
stick-table type string len 32 size 10k expire 1d peers aloha
stick on rdp_cookie(mstshash)

# Server farm
server tse1 weight 10 check inter 2s rise 2 fall 3
server tse2 weight 10 check inter 2s rise 2 fall 3
server tse3 weight 10 check inter 2s rise 2 fall 3
server tse4 weight 10 check inter 2s rise 2 fall 3

Now, the users can point their RDP client to the VIP and get load-balanced.
In case of client side network outage or Aloha failover, users will keep on being redirected to the same server.
The users won’t suffer any application outage.