Rate limit an HTTP API and tell clients the limits

8 steps · about 1 h 22 min · Intermediate

  1. Learn what rate limiting stops and what it cannot (article, Cloudflare, 6 min)

    Frames rate limits as abuse and overload protection.

  2. Spot unrestricted resource consumption in an API (reference, OWASP, 8 min)

    Shows the attack patterns that missing limits invite.

  3. Compare request, concurrency and load-shedding limiters (article, Stripe, 15 min)

    A real API team explains the limiter types they run and why.

  4. Enforce a leaky-bucket limit at the proxy with nginx limit_req (reference, nginx, 12 min)

    Configures limits before requests ever reach the app.

  5. Return 429 Too Many Requests correctly (reference, MDN Web Docs, 4 min)

    Defines the status code clients expect when limited.

  6. Advertise quota with the RateLimit header fields (reference, IETF, 15 min)

    Gives the standard way to tell clients their remaining budget.

  7. Study how GitHub documents primary and secondary limits (reference, GitHub Docs, 10 min)

    A mature public API's limit docs to model yours on.

  8. Layer rate limits into a wider denial-of-service defence (guide, OWASP Cheat Sheet Series, 12 min)

    Places per-client limits among the other controls you need.