blob: 7078213ad4a8eef68f92f637de4fb85861a652f6 [file] [log] [blame]
Amaury Denoyelle94fd1332021-05-12 10:51:22 +02001varnishtest "stick table: src_conn_rate"
2feature ignore_unknown_macro
3
4haproxy h0 -conf {
5 defaults
6 mode http
7 timeout connect 5s
8 timeout client 5s
9 timeout server 5s
10
11 listen li
12 ${no-htx} option http-use-htx
13 bind "fd@${fe1}"
14 http-request track-sc0 src table conn_rate_table
15 http-request deny if { src_conn_rate(conn_rate_table) gt 3 }
16 http-request return status 200
17
18 backend conn_rate_table
19 stick-table type ip size 1m expire 1m store conn_rate(1m)
20} -start
21
22client c0 -connect ${h0_fe1_addr}:${h0_fe1_port} {
23 txreq
24 rxresp
25 expect resp.status == 200
26} -run
27
28client c1 -connect ${h0_fe1_addr}:${h0_fe1_port} {
29 txreq
30 rxresp
31 expect resp.status == 200
32} -run
33
34client c2 -connect ${h0_fe1_addr}:${h0_fe1_port} {
35 txreq
36 rxresp
37 expect resp.status == 200
38} -run
39
40client c3 -connect ${h0_fe1_addr}:${h0_fe1_port} {
41 txreq
42 rxresp
43 expect resp.status == 403
44} -run