Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rednafi/nginx-ratelimit
A simple hello-world JSON API service that incorporates rate limiting via Nginx.
https://github.com/rednafi/nginx-ratelimit
go golang nginx nginx-docker nginx-proxy rate-limit rate-limiter rate-limiting
Last synced: 1 day ago
JSON representation
A simple hello-world JSON API service that incorporates rate limiting via Nginx.
- Host: GitHub
- URL: https://github.com/rednafi/nginx-ratelimit
- Owner: rednafi
- License: mit
- Created: 2024-01-06T02:47:05.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-07T12:22:34.000Z (about 1 year ago)
- Last Synced: 2025-01-06T02:23:45.112Z (6 days ago)
- Topics: go, golang, nginx, nginx-docker, nginx-proxy, rate-limit, rate-limiter, rate-limiting
- Language: Go
- Homepage: https://rednafi.com/go/rate_limiting_via_nginx/
- Size: 14.6 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nginx-ratelimit
A simple hello-world JSON API service that incorporates rate limiting via Nginx. It allows
50 requests per second and returns a 429 error when the limit is exceeded.See the blog post [here].
## Installation
```sh
git clone [email protected]:rednafi/nginx-ratelimit
```## Take it for a spin
- Start the service:
```sh
docker compose up -d
```- Test the rate limiting by sending many requests:
```sh
seq 200 | xargs -n 1 -P 100 bash -c 'curl -s localhost/greetings|jq'
```This returns:
```json
{
"message": "Hello World"
}
{
"message": "Hello World"
}
...
{
"status": 429,
"message": "Too Many Requests"
}
{
"status": 429,
"message": "Too Many Requests"
}
{
"message": "Hello World"
}
{
"status": 429,
"message": "Too Many Requests"
}
```[here]: https://rednafi.com/go/rate_limiting_via_nginx