Sticky sessions and drain not working together

Try lot of things without success
HAPROXY 2.4.3

I need the cookie …

Configuration
defaults
log global
option httplog
mode http
timeout connect 5s
timeout client 25s
timeout server 25s
timeout queue 10s

#Configuration 2.4.3
frontend stats
bind *:8404
stats enable
stats uri /stats
stats refresh 5s

#Configuration 1.5.18
#listen stat *:8404

stats enable

stats uri /stats

stats refresh 5s

frontend front_forms_bevor
mode http
maxconn 3000
bind 10.101.0.150:80
use_backend back_forms_bevor

backend back_forms_bevor
balance leastconn
log global
stick-table type ip size 1m expire 8h
stick on cookie(DWRSESSION)
stick on src
option httpchk HEAD /forms/frmservlet HTTP/1.0
option httpclose
option redispatch 1
retry-on all-retryable-errors
retries 3
http-request disable-l7-retry if METH_POST

http-request set-header X-Forwarded-Host %[req.hdr(host)]

http-request set-header X-Forwarded-Port %[dst_port]

http-request set-header X-Forwarded-Proto http if !{ ssl_fc }

http-request set-header X-Forwarded-Proto https if { ssl_fc }

http-request set-header Forwarded for=%[src];host=%[req.hdr(host)];proto=%[req.hdr(X-Forwarded-Proto)]

server svofmtst01 10.101.0.153:8420 weight 200 maxconn 2500 check cookie svofmtst01
server svofmtst02 10.101.0.154:8420 weight 200 maxconn 2500 check cookie svofmtst02

When I put the server svofmtst01 in drain mode, I’m always connected on svofmtst01 … No way to connect on the second one

This is expected behavior:

Setting the mode to “drain” only removes the server
from load balancing but still allows it to be checked and to accept new
persistent connections. Changes are propagated to tracking servers if any.

Seems like what you really want is maint mode?

Setting the state to “maint” disables any traffic
to the server as well as any health checks.

Many thanks for the answer.
Not really, the idea is to prepare a maintenance. Keeping actual connections and not authorize any new connections … I was thinking it was drain status.

What you just described is what drain does. What you are actually asking here is what maint does.

I’ve probably made a mistake …
My problem is : How to remove a server from backend (this server will not accept any new connections) without kick the actual users … I’ve try to play with drain, maint, and weight without success.

What do you mean with “kick the actual users” EXACTLY?

Either new HTTP transactions (with existing cookies) go to a different servers (maint) or they stay on the same server (drain). HTTP transactions without a cookies will go to a different server with both maint and drain mode.

First point : I need a jsessionid cookie otherwise my http backend don’t work correctly. So, I’ve a afinity/persistence.

For any reasons, I need to boot one server. Let’s say server sfofmtst01. I want to redirect all traffic to svofmtst02. But users who are still logged on to svofmtst01 should not lose their connections until they leave.

That is exactly what drain does.

But you want the sessions gone from the server, so you can reboot it, but at the same time you want users to stick with the server.

It’s either one or the other, you can’t have it both ways.