Skip to content

feat: add rate limiter to APIs#1183

Open
Bushstar wants to merge 5 commits intomainfrom
bush/rate-limiter
Open

feat: add rate limiter to APIs#1183
Bushstar wants to merge 5 commits intomainfrom
bush/rate-limiter

Conversation

@Bushstar
Copy link
Contributor

This PR introduces configurable rate limiting for all three API services (keymaster, gatekeeper, and search-server) using express-rate-limit, with consistent behavior and environment-driven controls.

  • Resolves: Add rate limiter to APIs #1182
  • Added API-level rate limiter middleware (/api scope only) to avoid throttling static frontend assets.
  • Standardized 429 response payload: {"error":"Too many requests"}.
  • Added support for:
    • configurable window (value + unit: second|minute|hour)
    • configurable max requests (default 600)
    • whitelist via CSV IP/CIDR
    • skip paths via CSV
    • optional proxy trust (*_TRUST_PROXY)
    • skipping OPTIONS requests
  • Moved Search Server env parsing into a dedicated config module: config.ts, matching the config pattern used by Keymaster/Gatekeeper.
  • Updated docs and config wiring:
    • root sample.env
    • service READMEs
    • docker-compose.yml env passthrough for new rate-limit/search-server variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add rate limiter to APIs

1 participant