New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Setting up an automatic HTTP Flood detector
PrincessOfCats
Member
in Help
I am looking to setup something similar to Reddit's request rate limiting system (See http://i.imgur.com/B9idLzo.png for example). Is there an existing method to do this for varnish/nginx/apache? Or will I have to code a custom module or something?
I can see that nginx has ngx_http_limit_req can limit the number of requests, but it seems to be simply limiting the number of requests that can be performed, and either delaying or discarding the remainder. I would like to show a page instead of delaying or discarding the requests that are getting over the limit.
Comments
Off the top of my head I'm thinking something like mod_bw or simple rlimit values for Apache at least, that being more of my comfort zone than nginx for more in depth controls.
Honestly an RLimitNPROC is my favorite way to just quickly say "Stop here, don't bother trying anymore at this point." I'm sure others will have more creative ideas
http://httpd.apache.org/docs/2.2/mod/core.html#rlimitnproc
Edit: Figured it out, ngx_http_limit_req has a configuration called limit_req_status code; which can then be used to set a custom error code. I can then set a page for the specific error code to show.
Nginx has a rate limit feature.