mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-10-10 07:01:21 +02:00
These counters maintain incoming and outgoing byte rates in a stick-table, over a period which is defined in the configuration (2 ms to 24 days). They can be used to detect service abuse and enforce a certain bandwidth limits per source address for instance, and block if the rate is passed over. Since 32-bit counters are used to compute the rates, it is important not to use too long periods so that we don't have to deal with rates above 4 GB per period. Example : # block if more than 5 Megs retrieved in 30 seconds from a source. stick-table type ip size 200k expire 1m store bytes_out_rate(30s) tcp-request track-counters src tcp-request reject if { trk_bytes_out_rate gt 5000000 } # cause a 15 seconds pause to requests from sources in excess of 2 megs/30s tcp-request inspect-delay 15s tcp-request content accept if { trk_bytes_out_rate gt 2000000 } WAIT_END