Ask A Question

Notifications

You’re not receiving notifications from this thread.

How to Rate Limit Requests in Rails 7.2 Discussion

This is very useful! No more rack attack... although it's possible this will not provide all features that rack attack gives us - right?

Reply

Rack Attack is still useful for safelists and blocklists, but the rate limiting / throttling feature is pretty much the same as what's built into Rails now.

The Rails rate limit feature is a bit more friendly since you get all the Rails features, while Rack Attack requires you to write your own Rack responses without any Rails helpers.

Both use the Rails cache store by default, so you won't need to reach for Rack Attack unless you want to setup safelists, blocklists, or another feature.

Reply

Not sure if I missed anything, but it does not use the Rails cache store by default, so I need to set it manually.

rate_limit to: 4, within: 1.minute, store: Rails.cache
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 85,376+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.