xin_li_90490
Mar 25, 2005Nimbostratus
limit frequent http GET
my website use bigip3400. and now a problem occured.someone from one session accessed our website, but about 3 http gets in 1 second. how can I limit it?
http://devcentral.f5.com/default.aspx?tabid=28&forumid=5&postid=1990&view=topic
Here is an example that demonstrates how to set the upper limit on the number of requests on a keep-alive connection.
when HTTP_RESPONSE {
if {[HTTP::request_num] > 2} {
HTTP::close
}
}
Limiting the request rate on the other hand is a little bit trickier for a lot of reasons. Could you tell us a little bit more what you are looking for?
and why you think i am trickier? I just want to know how to limit the http GET in a connection. isn't it a problem?
when HTTP_REQUEST {
set cur_time [clock seconds]
if { [HTTP::request_num] > 1 } {
if { $cur_time == $start_time } {
if { $reqs_sec > 3 } {
HTTP::respond 503 Retry-After 2
}
incr reqs_sec
return
}
}
set start_time $cur_time
set reqs_sec 0
}
After 3 requests per sec, this will respond with a 503 Server unavailable and Retry-After of 2 seconds.