To prevent malicious attacks, it is necessary to limit the speed of the client. How to implement it through APISIX?
Asked
Active
Viewed 212 times
2 Answers
0
Various plugins have been implemented in APISIX. To solve your problem, you can refer to Traffic Control plugins. More information: https://apisix.apache.org/plugins/#Traffic

Gepardo
- 11
- 1
0
You could implement this by using the limit-count
plugin. Below is an example for limiting the count to be two requests in time window of sixty seconds; if it is increased over that in sixty seconds, it will return 503 as the error code.
curl -i http://127.0.0.1:9180/apisix/admin/services/1 \
-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"plugins": {
"limit-count": {
"count": 2,
"time_window": 60,
"rejected_code": 503,
"key": "remote_addr",
"group": "services_1#1640140620"
}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:1980": 1
}
}
}'

Jeremy Caney
- 7,102
- 69
- 48
- 77

Ahmed Alsum
- 26
- 1
- 3