Rate limiting using Redis in a Rails app

There are some popular gems like rack-attack and rack-throttle which work quite well and provides a lot of flexibility. But if you're looking to write your custom logic with minimum dependencies, then continue reading.We will create a middleware that intercepts and blocks any host which tries to overload our servers by firing too many requests within a short timespan. We will be using Redis to store the count of requests from each IP address.Let's start by writing the most basic middleware.
Rate limiting using Redis in a Rails app #ruby #rubydeveloper #rubyonrails #redis https://rubyonrails.ba/single/rate-limiting-using-redis-in-a-rails-app

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles