HAProxy do not take behavior of roundrobin


#1

Dear all:
I just installed haproxy-1.8.4 and configured it as basic roundrobin setup, however I find phpmyadmin could not login as every time I typed login ID and password and click Login it will bring forward to next backend server and hence I get a new session ID, so I googled for dualing with cookie/session and find it could be solved by inserting “cookie SESSIONID insert postonly indirect” within the backend section, however after this statement I find it will not go to next server anymore.

Below is my configuration file, anything I am wrong ?

global
daemon
maxconn 256
#user haproxy
#group haproxy
log /var/log local0
log /var/log local1 notice
stats socket /var/run/haproxy/admin.sock mode 660 level admin
stats timeout 30s

    # Default SSL material locations
    #ca-base /etc/ssl/certs
    #crt-base /etc/ssl/private

defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms

frontend http-800-in
bind *:800 #This port will route to default port 80 defined by below “backend server” section
reqadd X-Forwarded-Proto:\ http
default_backend servers

backend servers
mode http
balance roundrobin
#Add this below to get the clients actually IP address. Without this,
#our application would instead see every incoming request as coming from the load balancer’s IP address
option forwardfor
#Add this to let our applications knows what port to use when redirecting/generating URLs
http-request set-header X-Forwarded-Port %[dst_port]

    #http-request add-header X-Forwarded-Proto https if { ssl_fc }
    option httpchk HEAD / HTTP/1.1\r\nHost:localhost

    ### Below is for http-auth feature ###
    acl draw-auth http_auth(auth_list)
    http-request auth realm draw unless draw-auth

    #Below is our backend server list
    cookie SESSIONID insert postonly indirect
    server ET-POC-RH01 123.45.67.8:80 check cookie check
    server ET-POC-RH02 123.45.67.9:80 check cookie check
    server ET-POC-RH03 123.45.67.10:80 check cookie check

#2

Dear all:
I have solved the problem just post there to your Ref. I revised the config coding of backend server section below and it worked

#Below is our revised backend server list
cookie ET-POC-RH01 insert indirect nocache
cookie ET-POC-RH02 insert indirect nocache
cookie ET-POC-RH03 insert indirect nocache
server ET-POC-RH01 123.45.67.8:80 check cookie ET-POC-RH01 maxconn 32 check
server ET-POC-RH02 123.45.67.9:80 check cookie ET-POC-RH02 maxconn 32 check
server ET-POC-RH03 123.45.67.10:80 check cookie ET-POC-RH03 maxconn 32 check