Micro service to limit search rate
This PR introduces application-level rate limiting to the /search route using Flask-Limiter. While there is already rate limiting at the content-cache level (as noted in the documentation), this enhancement adds a secondary layer of protection directly within the application.
Key Features:
- Limits each IP to 10 search requests per minute
- Custom error message returned when the limit is exceeded
- Lightweight and easy to maintain
- Helps prevent abuse and reduce load from spam or bots
Why this matters:
Rate limiting at the app level provides better transparency, immediate protection, and improved debugging. It also complements existing caching strategies without depending solely on infrastructure-level controls.
Implementation:
-
Flask-Limiteris initialized withget_remote_addressto track IPs - Applied directly to the search view before registering the route
Tested: Yes, locally with mock requests
DimondKudzai is not a collaborator of the repo
Hi @DimondKudzai! Thanks a lot for your contribution!
Could you please add Flask-Limiter to the dependencies list, specifying the exact version as well?