views:

132

answers:

0

Is there a way to queue up the requests by IP and process the requests in the same queue?

I would like to achieve the following: Say IP1 is sending 20 requests per minute - I want all these requests to be processed in sequence on completion of the request1, then req2 and so on ... This should not effect other requests from other IPs. Only the IP thats hitting with too many requests will get slowed response - but others will be fine. Any ideas on how to do this with Apache or mod_rails passenger per App?

What I have already done is: Limiting no. or requests per minute for all GET requests APIs and throwing an error with 403 status code once the limit crosses. Instead - just queue these requests from this IP and serve in the order of the requests queue.