ActionLimiter
Provides Redis backed rate limiting for Rails applications.
Installing
gem install actionlimiterbundle add actionlimiterUsage
Set Redis URL
Rails.application.configure do |config|
config.redis = { url: 'redis://localhost:6379/0' }
endRails IP Middleware
Rails.application.configure do |config|
# Limit a single IP to 20 requests in a 5 second period.
config.middleware.use(ActionLimiter::Middleware::IP, period: 5, size: 20)
end