Amaury Denoyelle | 94fd133 | 2021-05-12 10:51:22 +0200 | [diff] [blame] | 1 | varnishtest "stick table: src_conn_rate" |
| 2 | feature ignore_unknown_macro |
| 3 | |
| 4 | haproxy h0 -conf { |
| 5 | defaults |
| 6 | mode http |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame] | 7 | timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" |
| 8 | timeout client "${HAPROXY_TEST_TIMEOUT-5s}" |
| 9 | timeout server "${HAPROXY_TEST_TIMEOUT-5s}" |
Amaury Denoyelle | 94fd133 | 2021-05-12 10:51:22 +0200 | [diff] [blame] | 10 | |
| 11 | listen li |
Amaury Denoyelle | 94fd133 | 2021-05-12 10:51:22 +0200 | [diff] [blame] | 12 | 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 | |
| 21 | client c0 -connect ${h0_fe1_addr}:${h0_fe1_port} { |
| 22 | txreq |
| 23 | rxresp |
| 24 | expect resp.status == 200 |
| 25 | } -run |
| 26 | |
| 27 | client c1 -connect ${h0_fe1_addr}:${h0_fe1_port} { |
| 28 | txreq |
| 29 | rxresp |
| 30 | expect resp.status == 200 |
| 31 | } -run |
| 32 | |
| 33 | client c2 -connect ${h0_fe1_addr}:${h0_fe1_port} { |
| 34 | txreq |
| 35 | rxresp |
| 36 | expect resp.status == 200 |
| 37 | } -run |
| 38 | |
| 39 | client c3 -connect ${h0_fe1_addr}:${h0_fe1_port} { |
| 40 | txreq |
| 41 | rxresp |
| 42 | expect resp.status == 403 |
| 43 | } -run |