Skip to content

Instantly share code, notes, and snippets.

@felipekm
Created February 26, 2025 18:47
Show Gist options
  • Save felipekm/b20f15eae85e36650e12e547a6fdde92 to your computer and use it in GitHub Desktop.
Save felipekm/b20f15eae85e36650e12e547a6fdde92 to your computer and use it in GitHub Desktop.
NGINX rate limiter - Prevent excessive API requests from a single IP or user
http {
limit_req_zone $binary_remote_addr zone=api_limit:10m rate=10r/s;
server {
location /api/ {
limit_req zone=api_limit burst=20 nodelay;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment