Forum Discussion
- SajinNimbostratus
Just to add on my above question, here is the iRule I have written and looking for a modification to make the above requirement work:
when RULE INIT {
set static::maxRate 100
set static: windowSecs 1
}
when HTTP REQUEST {
if { ([HTTP::host] eq "test.abc.com") } {
if { ([HTTP::uri] starts with "/common/xyz" ) }
{
set variables
set limiter [string tolower [HTTP: uri]]
set clientip limitervar [IP: :client_addr]
if { $get count < $static::maxRate } {
incr get count 1
log local0. get count
table set $get_count indefinite $static: :windowsecs
} } else {
log local0. "Sclientip_limitervar has exceeded the number of requests allowed." drop
return
}
}
}
You are going in the right way with the table command, so keep at it.
You can get ideas from my code for ASM rate limit:
- SajinNimbostratus
Hi Nikoolay, the traffic on the homepage and other URI's also getting impacted with this iRule. I think need to have some modifications on this rule.