Add rate limit for gitea

This commit is contained in:
Felix Ableitner 2020-06-19 21:58:18 +02:00
parent 30d3daadea
commit 912779862c
2 changed files with 4 additions and 9 deletions

View file

@ -1,4 +1,4 @@
version: "3.3" version: "2.2"
services: services:
@ -15,6 +15,7 @@ services:
depends_on: depends_on:
- redis - redis
- postfix - postfix
mem_limit: 500m
weblate: weblate:
image: weblate/weblate:4.1-2 image: weblate/weblate:4.1-2

View file

@ -1,5 +1,4 @@
limit_req_zone $binary_remote_addr zone=gitea_ratelimit:10m rate=5r/s; limit_req_zone $binary_remote_addr zone=gitea_ratelimit:10m rate=1r/s;
limit_req_zone $binary_remote_addr zone=limit_commit_view:10m rate=2r/m;
server { server {
listen 80; listen 80;
@ -46,13 +45,8 @@ server {
gzip_proxied any; gzip_proxied any;
gzip_vary on; gzip_vary on;
location ~ ".*/commit/.*" {
limit_req zone=limit_commit_view burst=5;
proxy_pass http://127.0.0.1:3000;
#return 500;
}
location / { location / {
limit_req zone=req_limit_per_ip burst=20 nodelay; limit_req zone=gitea_ratelimit burst=30 nodelay;
proxy_pass http://127.0.0.1:3000; proxy_pass http://127.0.0.1:3000;
} }
} }