Gem to block excessive/unwanted requests. This gem right now works only with rails.
Add this line to your application's Gemfile:
gem 'dwarpaal', :github => 'ranupratapsingh/dwarpaal', :branch=>'master'
And then execute:
bundle
TO use this gem
- include it in Gemfile
- run bundle install
- run following command from rails root
rails g migration CreateRequestLog ip_address:string c_date:date req_path:text
- in
config/application.rb
add following configuration
Sample Code:
class Application < Rails::Application
config.middleware.use Dwarpaal::Talashi, :initial_max_hits => 10
end
We can give additional options for the Gem like below
class Application < Rails::Application
config.middleware.use Dwarpaal::Talashi, :initial_max_hits => 10
end
All acceptable options are:
- initial_max_hits -> per day allowed hits without check
- allowed_increase -> allowed percentage increase for a week
- code -> response code when not allowed
- message -> message when request is not allowed