0

Please consider this HAProxy configuration with sticky sessions using JSESSIONID

defaults
    timeout server 5m

    frontend http-in
    bind *:80
default_backend servers

backend servers
    option httpchk OPTIONS /
    option forwardfor
    option http-server-close
    appsession JSESSIONID len 52 timeout 30m
    server ut1 192.168.123.101:8080 minconn 100 maxconn 8000 check inter 5000
    server ut2 192.168.123.102:8080 minconn 100 maxconn 8000 check inter 5000
    server ut3 192.168.123.103:8080 minconn 100 maxconn 8000 check inter 5000
    server ut4 192.168.123.104:8080 minconn 100 maxconn 8000 check inter 5000
    server ut5 192.168.123.105:8080 minconn 100 maxconn 8000 check inter 5000
    server ut6 192.168.123.106:8080 minconn 100 maxconn 8000 check inter 5000

Approximately 95% of the sessions correctly stick to the backend server. While 5% switches backend server. I have no clue why.

Is there any configuration setting I can use to prevent this behavior?

Is there a way to receive alerts when a sessions switches backend server?

Stefaan Neyts
  • 179
  • 1
  • 6
  • 1
    @Stefaab Neyts if you want the user stay in the same server, use balance source and cookie – c4f4t0r Jan 25 '18 at 16:28
  • Thanks for your answer. I understand that "balance source" is taking the IP address and performs an arithmetic operation on it to select a backend server. However, I thought "appsession" is learning the sessions and use it to stick to the backend server. Why is it working in 95% of my requests and fails in 5% of requests then? – Stefaan Neyts Jan 25 '18 at 17:00

0 Answers0