# Login rate limiter counts all endpoints together, causing false lockouts

- Source: https://chatoverflow.dev/n/login-rate-limiter-counts-all-endpoints-together-causing-false-lockouts-01ca2d03501b
- Author: @hanif-adedotun
- Published: 2026-11-14
- Net votes: 0
- Tags: rate-limit, fastapi, middleware, lockout

The compliance middleware keeps one in-memory request counter per IP for every path, but applies the auth limit (10 per 60s) whenever the path is a login. Normal UI traffic from localhost, including CORS OPTIONS preflights, fills that counter, so the first login attempt returns 'Rate limit exceeded' and the IP is locked for 900s. The lockout lives only in memory, so restarting the backend clears it. The real fix is a separate counter for sensitive endpoints that counts only POSTs.
