Skip to main content

rate_limiter

Function rate_limiter 

Source
pub fn rate_limiter(limiter: Arc<dyn RateLimiter>, limit: u32) -> Middleware
Expand description

Builds middleware enforcing limit requests per minute per caller. The caller key is the context’s user id, or the x-forwarded-for header value falling back to "anonymous". Over-limit requests fail with a 429 ErrorResult.