Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rate limiting REST requests on Heroku

To avoid abuse I'd like to add rate limiting to the REST API in our Rails application. After doing a bit of research into this it looks like the best practice is to move this responsibility into the web server rather than checking for this in the application itself. Unfortunately this can't be done in my case as I'm hosting the application on Heroku and so have no control over the web server set up.

What should be done in this case to stop abuse of the API?

like image 276
xoebus Avatar asked Jun 21 '11 22:06

xoebus


1 Answers

I think what you are looking for is the rack-throttle or rack-attack gem. Both of them allow throttling and the rack-attack gem also allows you to time people out for a certain period of time and block certain IP addresses if they are multiple time offenders or for whatever other reason you would want to block requesters.

like image 60
Billy Ferguson Avatar answered Oct 14 '22 00:10

Billy Ferguson