Hello,
I would like to limit the number of simultaneously connected person on an
online shop, to keep a certain "site reactivity."

I am inspired by the configuration:
http://fotoarkiv.com/wordpress/limiting-the-number-of-active-users-on-a-site-using-haproxy/

but I have a problem I can not use cookies, because we want the users do
not stay more than 20 minutes
I would like haproxy looks in the table sesssions, and redirects users only
present in the list.

I tried different conditions, but it does not work, it provided to check if
the IP happens is present in the table (http)
of "stickies sessions"?

This is a version of "demonstration" with a limited one person to test
easily!

=======================8<=====================================================
#The frontend config:
frontend http
bind *:80

stick-table type ip size 1 expire 1m store gpc0

#use_backend newuser if { table_avl(http) ge 1 }
#use_backend allowed if { src_get_gpc0(http) gt 0 }
use_backend allowed if { src_conn_cur(http) gt 0 }
#use_backend allowed if { src_conn_cnt(http) gt 0 }
#use_backend allowed if { src_conn_rate(http) gt 0 }
#use_backend allowed if { src_http_req_cnt(http) gt 0 }
#use_backend allowed if { src_http_req_rate(http) gt 0 }

acl allowed_new table_avl(http) ge 1
use_backend newuser if allowed_new

default_backend static


backend newuser
stick store-request src table http
server marchand_website_new_user XXXXXXXX:80 maxconn 1


backend allowed
stick store-request src table http
server marchand_website_allowed XXXXXXXXXXXX:80 maxconn 1


backend static
server statique_website  XXXXXXXXXXXX:80 maxconn 1

==================================<8============================================


I have the table (http) that fills, but on the second pass I am redirected
to the static:

Every 2,0s: echo show table http  | socat /var/run/...  Wed Jan 29 09:49:55
2014

# table: http, type: ip, size:1, used:1
0x24b52c8: key=80.215.192.123 use=0 exp=48378 server_id=1 gpc0=0


Thanks

I'll try with headers, but I want to understand what I did not understand

Reply via email to