Forum Discussion
HTTP request per second limit
Is there any idea or example how to limit the HTTP request per second ?
Thx.
BR
Billy
- Hamish
Cirrocumulus
There is an iRule somewhere on codeshare that will rate limit connection rates. - hoolio
Cirrostratus
There are two methods used in Codeshare examples. Perhaps you could combine them to enforce the limiting you want? If you can provide more detail on what type of logic you want to implement, we can give you more detailed suggestions and/or examples. Below is the iRule which Rate limit based on HTTP method
when RULE_INIT { set static::allowedRate 10 } when HTTP_REQUEST { set count [table loolkup -notouch [HTTP::method] ] if { $count eq "" } { Add entry into table with count as 1 for 1 second table add [HTTP::method] 1 1 } elseif { $count < $static::allowedRate } { Increment count table incr -notouch [HTTP::method] 1 } else { No of HTTP request exceeded per second do your action here HTTP::respond 503 } }
Syed
when RULE_INIT {
set static::allowedRate 10
}
when HTTP_REQUEST {
set count [table loolkup -notouch [HTTP::method] ] if { $count eq "" } { Add entry into table with count as 1 for 1 second table add [HTTP::method] 1 1 } elseif { $count < $static::allowedRate } { Increment count table incr -notouch [HTTP::method] 1 } else { No of HTTP request exceeded per second do your action here HTTP::respond 503 }
}
--Formatted
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com