- Go
- Redis
- Docker
- Middleware
- Strategy Pattern
HTTP middleware designed to protect web services against traffic spikes and abuse. Implements rate limiting based on client IP addresses or custom access tokens with independent limits and block windows:
- Dual Limiting Strategy: Controls requests per second per IP, with prioritized token-based overrides (via
API_KEYheader) - Strategy Pattern Architecture: Decouples rate-limiting evaluation and storage from the HTTP middleware layer, allowing seamless swapping of Redis for other backends
- Configurable Thresholds: Independent request limits and cooldown/block durations driven by environment variables
- Standard Protocol Compliance: Returns HTTP 429 (
Too Many Requests) with clear messaging upon exceeding configured limits - Reproducible Setup: Includes automated unit/integration tests and Docker Compose for the application and Redis server
