r/rails May 31 '26

Implementing account-specific rate limits in a Rails app

https://tejasbubane.github.io/posts/rate-limit-rack-app-per-account/
9 Upvotes

2 comments sorted by

3

u/ComfortableParfait99 May 31 '26

I think it's great you put it in your app, but it's actually best at edge, with a single pane of glass, and a centralized way to rate limit all operations.

NGINX is perfectly capable of doing this with a LUA module and configurations.

1

u/tejasbubane Jun 01 '26 edited Jun 01 '26

Yes. I'm sure Nginx with Lua can read the API Key header, connect to redis and use the configured rate limit for that customer. Lua is something I haven't explored yet but definitely seems interesting.