Rate limiting using Redis in a Rails app
20-Apr-2021 1663
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 #limiting #using #Redis #Rails #redis https://rubyonrails.ba/link/rate-limiting-using-redis-in-a-rails-app