HAProxy close Moodle sesions


#1

Hi all

Im using moodle, the user log into Moodle and navigate, but after 3 or 4 minuts the sesion closed and need to login again, every 3 or 4 minuts always.

I tried to modify diferente parameters

global
log 127.0.0.1 local2 #Log configuration

chroot      /var/lib/haproxy
pidfile     /var/run/haproxy.pid
maxconn     4000                
user        haproxy             #Haproxy running under user and group "haproxy"
group       haproxy
daemon

# turn on stats unix socket
stats socket /var/lib/haproxy/stats

defaults
mode http
log global
option httplog
option dontlognull
#option http-server-close
option http-keep-alive
##option forwardfor except 127.0.0.0/8
##option redispatch
##retries 3
##timeout http-request 10s
##timeout queue 20s
timeout connect 2s
timeout client 10m #La sesion se cierra tras x inactividad del cliente
timeout server 20m #El servidor cierra tu conexión en sin importar el cambio de página
##timeout http-keep-alive 30m #La sesion se cierra tras x inactividad
##timeout check 20m
maxconn 3000
balance source

listen haproxy3-monitoring *:8080 #Haproxy Monitoring run on port 8080
mode http
##option forwardfor
#option httpclose
##option http-server-close
stats enable
stats show-legends
stats refresh 5s
stats uri /statsx #URL for HAProxy monitoring
stats realm Haproxy\ Statistics
stats auth stats:123pormi #User and Password for login to the monitoring dashboard
stats admin if TRUE
stats auth admin:pass

frontend public
bind *:80
##default_backend app-main
###ACL
acl adistanciaBackend hdr_beg(host) -i adistancia.
acl appsBackend hdr_beg(host) -i apps.
acl wwwBackend hdr_beg(host) -i www.
####
use_backend adistancia if adistanciaBackend
##use_backend apps if appsBackend
##use_backend www if wwwBackend

##backend app-main

balance roundrobin #Balance algorithm

## option httpchk HEAD / HTTP/1.1\r\nHost:\ localhost    #Check the serveris up and healty - 200 status code
  ###server ciclope 192.168.2.94:80 check
     ##server vulcano 192.168.2.96:80 check

backend adistancia
balance roundrobin
#balance source #Balance algorithm
option httpchk HEAD / HTTP/1.1\r\nHost:\ localhost #Check the serveris up and healty - 200 status code
cookie SERVERID insert indirect
##cookie SERVERID rewrite maxlife 120m
##cookie SERVERID prefix nocache maxlife 33m
server vulcano 192.168.2.96:80 check cookie vulcano

##backend apps

balance roundrobin #Balance algorithm

##option httpchk HEAD / HTTP/1.1\r\nHost:\ localhost    #Check the serveris up and healty - 200 status code
##cookie SERVERID insert indirect nocache
##server vulcano 192.168.2.96:80 check cookie vulcano
###server ciclope 192.168.2.94:80 check cookie ciclope

backend www
balance roundrobin #Balance algorithm
option httpchk HEAD / HTTP/1.1\r\nHost:\ localhost #Check the serveris up and healty - 200 status code
#server ciclope 192.168.2.94:80 check
server vulcano 192.168.2.96:80 check


#2

Does it work as expected with only 1 active server per backend?