Save 36% for Black Friday! Learn more

New Discussion

Notifications

You’re not receiving notifications from this thread.

How to Rate Limit Requests in Rails 7.2 Discussion

3
General

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

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.

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

Thank you! !

Join the discussion
Create an account Log in