Registry / web-framework / rack-attack

rack-attack

JSON →
library6.8.0rbrubygemsunverified

Rack middleware for throttling and blocking abusive requests to protect your web application.

gem install rack-attack
INSTALL
IMPORT
SIG · RACK-ATTACK
R
rack-attack
web-frameworkrubyv6.8.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Rack::Attack
require 'rack/attack'

Basic throttling by IP address

require 'rack/attack' Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new Rack::Attack.throttle('req/ip', limit: 5, period: 1.second) do |req| req.ip end
Debug
Known issues
gotchaRequires a cache store (e.g., Redis or Memcached) for production use; memory store is not suitable for multi-process environments.
fix
Configure a shared cache store like Redis via Rack::Attack.cache.store = Redis.new
affects: >= 6.0.0
Upgrade
Version history
6.8.0latest on RubyGems
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
rack-attack — gem install rack-attack · libregistry