Rate Limiting
This commit is contained in:
3
Makefile
3
Makefile
@@ -181,6 +181,9 @@ wrk-search: ## Нагрузочный тест поиска (wrk2)
|
|||||||
-H "Authorization: Bearer $$TOKEN" \
|
-H "Authorization: Bearer $$TOKEN" \
|
||||||
http://localhost:8080/v1/search?type=event\&q=test
|
http://localhost:8080/v1/search?type=event\&q=test
|
||||||
|
|
||||||
|
curl-health:
|
||||||
|
for i in {1..120}; do curl -k -s -o /dev/null -w "%{http_code}\n" -H "Host: api.eventhub.local" https://localhost/health; done
|
||||||
|
|
||||||
wrk-health: ## Нагрузочный тест health (wrk2)
|
wrk-health: ## Нагрузочный тест health (wrk2)
|
||||||
wrk -t4 -c100 -d30s -t100 \
|
wrk -t4 -c100 -d30s -t100 \
|
||||||
-H "Host: api.eventhub.local" \
|
-H "Host: api.eventhub.local" \
|
||||||
|
|||||||
@@ -26,18 +26,30 @@ http:
|
|||||||
# - "SecRule REQUEST_URI \"@rx /admin\" \"id:101,phase:1,log,deny,status:403\""
|
# - "SecRule REQUEST_URI \"@rx /admin\" \"id:101,phase:1,log,deny,status:403\""
|
||||||
- "SecRule ARGS \"@rx (union|select|insert|drop|alter)\" \"id:102,phase:2,log,deny,status:403\""
|
- "SecRule ARGS \"@rx (union|select|insert|drop|alter)\" \"id:102,phase:2,log,deny,status:403\""
|
||||||
|
|
||||||
|
api-ratelimit:
|
||||||
|
rateLimit:
|
||||||
|
average: 100
|
||||||
|
period: 1m
|
||||||
|
burst: 50
|
||||||
|
|
||||||
|
admin-ratelimit:
|
||||||
|
rateLimit:
|
||||||
|
average: 20
|
||||||
|
period: 1m
|
||||||
|
burst: 5
|
||||||
|
|
||||||
routers:
|
routers:
|
||||||
# REST API пользователей
|
# REST API пользователей
|
||||||
api:
|
api:
|
||||||
rule: "Host(`api.eventhub.local`)"
|
rule: "Host(`api.eventhub.local`)"
|
||||||
entryPoints: ["web"]
|
entryPoints: ["web"]
|
||||||
middlewares: ["redirect-to-https", "waf"]
|
middlewares: ["redirect-to-https", "api-ratelimit", "waf"]
|
||||||
service: "api"
|
service: "api"
|
||||||
api-secure:
|
api-secure:
|
||||||
rule: "Host(`api.eventhub.local`)"
|
rule: "Host(`api.eventhub.local`)"
|
||||||
entryPoints: ["websecure"]
|
entryPoints: ["websecure"]
|
||||||
tls: true
|
tls: true
|
||||||
middlewares: ["waf"]
|
middlewares: ["api-ratelimit", "waf"]
|
||||||
service: "api"
|
service: "api"
|
||||||
|
|
||||||
# WebSocket пользователей (без WAF)
|
# WebSocket пользователей (без WAF)
|
||||||
@@ -56,13 +68,13 @@ http:
|
|||||||
admin-api:
|
admin-api:
|
||||||
rule: "Host(`admin.eventhub.local`)"
|
rule: "Host(`admin.eventhub.local`)"
|
||||||
entryPoints: ["web"]
|
entryPoints: ["web"]
|
||||||
middlewares: ["redirect-to-https", "waf"]
|
middlewares: ["redirect-to-https", "admin-ratelimit", "waf"]
|
||||||
service: "admin-api"
|
service: "admin-api"
|
||||||
admin-api-secure:
|
admin-api-secure:
|
||||||
rule: "Host(`admin.eventhub.local`)"
|
rule: "Host(`admin.eventhub.local`)"
|
||||||
entryPoints: ["websecure"]
|
entryPoints: ["websecure"]
|
||||||
tls: true
|
tls: true
|
||||||
middlewares: ["waf"]
|
middlewares: ["admin-ratelimit", "waf"]
|
||||||
service: "admin-api"
|
service: "admin-api"
|
||||||
|
|
||||||
# Админский WebSocket (без WAF)
|
# Админский WebSocket (без WAF)
|
||||||
|
|||||||
Reference in New Issue
Block a user