blob: bdf8869bee30bbb154107aba886e64166610b42a [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
Willy Tarreauf6739232021-11-18 17:46:22 +01007 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
8 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
9 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Amaury Denoyelle94fd1332021-05-12 10:51:22 +020010
11 listen li
Amaury Denoyelle94fd1332021-05-12 10:51:22 +020012 bind "fd@${fe1}"
13 http-request track-sc0 src table conn_rate_table
14 http-request deny if { src_conn_rate(conn_rate_table) gt 3 }
15 http-request return status 200
16
17 backend conn_rate_table
18 stick-table type ip size 1m expire 1m store conn_rate(1m)
19} -start
20
21client c0 -connect ${h0_fe1_addr}:${h0_fe1_port} {
22 txreq
23 rxresp
24 expect resp.status == 200
25} -run
26
27client c1 -connect ${h0_fe1_addr}:${h0_fe1_port} {
28 txreq
29 rxresp
30 expect resp.status == 200
31} -run
32
33client c2 -connect ${h0_fe1_addr}:${h0_fe1_port} {
34 txreq
35 rxresp
36 expect resp.status == 200
37} -run
38
39client c3 -connect ${h0_fe1_addr}:${h0_fe1_port} {
40 txreq
41 rxresp
42 expect resp.status == 403
43} -run