This example add a Rate Limiting Plugin to the echo-route on the echo-service. The Route will be limited to 20 requests per minute, or one request every three seconds.
Add the Plugin
-
Click Services on the menu.
-
Click the echo-service Service.
-
Click the Routes tab.
-
Click the echo-route Route.
-
Click the Plugins tab.
-
Click the Add action icon.
-
Select the "Rate Limiting" plugin type.
-
Enter the Plugin description, for example "Limit to 20 requests per minute by client IP".
-
Enter 20 in the Rate field.
-
Select Minute from the Per dropdown.
-
Select Limit by - Client IP.
-
Click SAVE.
Test the Configuration
-
From the Console Dashboard, start the gateway or redeploy the gateway configuration.
-
In the browser window connected to the gateway, repeatedly click the refresh button. Requests that exceed the one every 3 seconds rate second limit will return HTTP error 429 "Too Many Requests".
-
In your browser, enter the Echo Service: https://echo-service.demo.nuwavetech.com/echo
-
Repeatedly click the browser refresh button. The response should be returned immediately each time the refresh button is clicked.