web / lib/services/rate-limit-service
lib/services/rate-limit-service
Provides a service for rate-limiting requests.
This service implements a flexible, in-memory rate-limiting mechanism to protect endpoints from abuse. It tracks requests from different identifiers (like IP addresses or session IDs) and enforces limits based on a specified number of requests within a given time window.
Key features include:
- Checking if a request is allowed.
- Blocking identifiers that exceed the limit.
- Providing standard rate-limit headers for HTTP responses.
- Automatic cleanup of expired entries.