Merge pull request #7622 from Budibase/configurable-api-rate-limit
Configurable api rate limit through nginx
This commit is contained in:
commit
6cee01ed74
|
@ -78,6 +78,7 @@ services:
|
||||||
image: budibase/proxy
|
image: budibase/proxy
|
||||||
environment:
|
environment:
|
||||||
- PROXY_RATE_LIMIT_WEBHOOKS_PER_SECOND=10
|
- PROXY_RATE_LIMIT_WEBHOOKS_PER_SECOND=10
|
||||||
|
- PROXY_RATE_LIMIT_API_PER_SECOND=20
|
||||||
depends_on:
|
depends_on:
|
||||||
- minio-service
|
- minio-service
|
||||||
- worker-service
|
- worker-service
|
||||||
|
|
|
@ -11,7 +11,7 @@ events {
|
||||||
http {
|
http {
|
||||||
# rate limiting
|
# rate limiting
|
||||||
limit_req_status 429;
|
limit_req_status 429;
|
||||||
limit_req_zone $binary_remote_addr zone=ratelimit:10m rate=20r/s;
|
limit_req_zone $binary_remote_addr zone=ratelimit:10m rate=${PROXY_RATE_LIMIT_API_PER_SECOND}r/s;
|
||||||
limit_req_zone $binary_remote_addr zone=webhooks:10m rate=${PROXY_RATE_LIMIT_WEBHOOKS_PER_SECOND}r/s;
|
limit_req_zone $binary_remote_addr zone=webhooks:10m rate=${PROXY_RATE_LIMIT_WEBHOOKS_PER_SECOND}r/s;
|
||||||
|
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
|
|
|
@ -11,3 +11,4 @@ COPY error.html /usr/share/nginx/html/error.html
|
||||||
|
|
||||||
# Default environment
|
# Default environment
|
||||||
ENV PROXY_RATE_LIMIT_WEBHOOKS_PER_SECOND=10
|
ENV PROXY_RATE_LIMIT_WEBHOOKS_PER_SECOND=10
|
||||||
|
ENV PROXY_RATE_LIMIT_API_PER_SECOND=20
|
Loading…
Reference in New Issue