https://github.com/ralgond/ngx_http_rate_limit_request_module
A rate limit module for Nginx.
https://github.com/ralgond/ngx_http_rate_limit_request_module
nginx nginx-module rate-limit rate-limiter
Last synced: 5 months ago
JSON representation
A rate limit module for Nginx.
- Host: GitHub
- URL: https://github.com/ralgond/ngx_http_rate_limit_request_module
- Owner: ralgond
- License: bsd-2-clause
- Created: 2024-11-08T12:20:36.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-11-14T14:34:59.000Z (11 months ago)
- Last Synced: 2025-01-09T06:47:00.228Z (9 months ago)
- Topics: nginx, nginx-module, rate-limit, rate-limiter
- Language: C
- Homepage:
- Size: 17.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ngx_http_rate_limit_request_module
A rate limit module for Nginx## Nginx Version
1.24.0## Introduction
The ```ngx_http_rate_limit_request_module``` module implements rate limit functionality based on the result of a subrequest. If the subrequest returns a 2xx response code, the access is allowed. If it returns 429 or 403, the access is denied with the corresponding error code. Any other response code returned by the subrequest is considered an error.
It's an important component of this [service](https://github.com/ralgond/rate-limit-server)
## Example Configuration
```bash
location / {
rate_limit_request /rate_limit;
...
}location = /rate_limit {
internal;
proxy_pass ... # proxy_pass http://backend_ratelimit$request_uri
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Method $request_method;
proxy_set_header X-Original-URI $request_uri;
proxy_set_header Content-Type "";
proxy_set_header Content-Length 0;
proxy_set_header Connection "keep-alive";
proxy_pass_request_body off;
}
```
## Directives
- Syntax: **rate_limit_request** *uri* | *off*;
- Default: **rate_limit_request** *off*;
- Context: http, server, locationEnables rate limit functionality based on the result of a subrequest and sets the URI to which the subrequest will be sent.