mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-06 11:49:14 +02:00
feat:#36 added limit to proxy for POST
This commit is contained in:
@@ -57,6 +57,31 @@ http {
|
|||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
|
||||||
|
geo $admin {
|
||||||
|
default 1;
|
||||||
|
#10.0.0.0/8 0; # Private Network
|
||||||
|
#127.0.0.0/8 0; # Localhost Network
|
||||||
|
#192.168.0.0/16 0; # Localhost Network
|
||||||
|
#141.57.0.0/16 0; # HTWK Leipzig Network
|
||||||
|
#172.16.0.0/12 0; # Private Network
|
||||||
|
}
|
||||||
|
|
||||||
|
map $admin $limit_key {
|
||||||
|
0 '';
|
||||||
|
1 $binary_remote_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
map $request_method $ratelimit_key {
|
||||||
|
POST $binary_remote_addr;
|
||||||
|
default $binary_remote_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
limit_req_zone $ratelimit_key zone=createFeed:10m rate=1r/s;
|
||||||
|
#limit_req_zone $limit_key zone=createFeed:10m rate=1r/m;
|
||||||
|
# Limit the number of requests per IP
|
||||||
|
limit_req_zone $limit_key zone=feed:20m rate=20r/m;
|
||||||
|
limit_req_zone $limit_key zone=modules:10m rate=30r/m;
|
||||||
|
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
@@ -70,6 +95,7 @@ http {
|
|||||||
proxy_read_timeout 600s;
|
proxy_read_timeout 600s;
|
||||||
proxy_send_timeout 600s;
|
proxy_send_timeout 600s;
|
||||||
send_timeout 600s;
|
send_timeout 600s;
|
||||||
|
limit_req zone=createFeed nodelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /api {
|
location /api {
|
||||||
|
Reference in New Issue
Block a user