You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[PeerIpKeyExtractor]: this is the default, it uses the peer IP address of the request.
[SmartIpKeyExtractor]: Looks for common IP identification headers usually provided by reverse proxies in order(x-forwarded-for,x-real-ip, forwarded) and falls back to the peer IP address.
[GlobalKeyExtractor]: uses the same key for all incoming requests
for a global extractor we should use tower govern or tower
tower example, from here:
tower govern also has custom_key_bearer which could be used for per user rate limiting, instead of by ip, by grabbing the jwt token then calling the database and adding the user id to the custom_key_bearer, but this option has a database call
The text was updated successfully, but these errors were encountered:
@NexVeridian
What about distributed service? The rate limit counters are stored in a single process, which creates a problem when scaling out across multiple instances.
which creates a problem when scaling out across multiple instances.
I did find this comment by the library creator talking about that
So maybe have both a per instances rate limit, and a database based rate limiter if guaranteeing a low limit is important for that route
But a database based rate limiter would probably have to be manually implemented, I haven't been able to find a widely used maintained redis based tower middleware for rate limiting
Tower Governor some built in ones that might be useful
[PeerIpKeyExtractor]: this is the default, it uses the peer IP address of the request.
[SmartIpKeyExtractor]: Looks for common IP identification headers usually provided by reverse proxies in order(x-forwarded-for,x-real-ip, forwarded) and falls back to the peer IP address.
[GlobalKeyExtractor]: uses the same key for all incoming requests
for a global extractor we should use tower govern or tower
tower example, from here:
tower govern also has custom_key_bearer which could be used for per user rate limiting, instead of by ip, by grabbing the jwt token then calling the database and adding the user id to the custom_key_bearer, but this option has a database call
The text was updated successfully, but these errors were encountered: