Rate limiting rails rack gem. Add to gem file to start limiting based on IP
Add this line to your application's Gemfile:
gem 'notsofast'
And then execute:
$ bundle
Or install it yourself as:
$ gem install notsofast
By default starts limiting on 100 requests per minute. This is on an IP address basis.
Create a rails initializer (config/initializers/notsofast.rb) with the following as required
### whitelist Set an array of string values containing whitelisted ip addresses eg ["127.0.0.1"]
Notsofast::Config.whitelist=[]
### blacklist Set an array of string values containing blacklisted ip addresses eg ["127.0.0.1"]
Notsofast::Config.blacklist=[]
Specifies the number of permitted request per limit_exipry period
Notsofast::Config.request_limit=100
Specifies the response types that the limit applies to (eg ignore images and other assets)
Notsofast::Config.response_types=["text/html"]
### limit_expiry Sets the time before limits are reset and within which the limit is reached
Notsofast::Config.limit_expiry=60
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request