Skip to main content

Module rate_limit

Module rate_limit 

Source
Expand description

Per-IP rate limiting middleware backed by governor.

Use per_minute to create a limiter, then install the rate_limit middleware on the desired router group. Rate-limited responses include X-RateLimit-Limit / Retry-After headers and return HTTP 429 with a JSON error body.

Structs§

RateLimitState
Shared rate limiter state, injected as an Axum extension.

Functions§

per_minute
Build a per-IP rate limiter allowing requests_per_minute requests per minute.
rate_limit
Axum middleware that enforces per-IP rate limiting.