How to apply rate limiting through the UI
This page explains how to use the Traefik Hub UI to apply rate limiting to APIs.
Before you begin¶
Before getting started, please make sure to read the general documentation about rate limiting to understand how rate limiting works.
Create a new rate limit¶
Applying a rate limit to an API consists of multiple steps.
You will learn how to define a rate limit policy by:
- Selecting the Traefik Hub agent and the rate limit strategy.
- Configuring the number of allowed requests.
- Setting a time period.
- Select an API for the new rate limit policy.
- Assigning the rate limit to a user group.
Bear in mind
- You can configure multiple rate limits per Traefik Hub agent.
- An API can have multiple rate limit policies.
- You can only define one strategy per rate limit. For example, you could have two (or more) policies with a different number of allowed requests.
Please choose the appropriate walk-through to get started.
- Select Local rate limiting for creating a rate limit policy using the local strategy.
- Select Distributed rate limiting for the distributed strategy.
Traefik Hub agent configuration
If you select a Traefik Hub agent that does not support distributed, a warning will be displayed.
If you haven't done already, login into the Traefik Hub UI.
First, select API rate limits in the left navigation menu.
This is your overview page about all configured rate limits.
In the next step, select Create rate limit in the top right corner.
See the following configuration settings used in this example.
Field | Description | Example |
---|---|---|
Name | Name the new rate limit policy | flight-api-rate-limit |
Agent | the Traefik Hub agent where the API for the new rate limit policy is hosted | demo-agent |
Strategy | Select rate limit strategy | local |
Limit | Number of allowed requests pre defined time period | 100 |
Period | Time period can be seconds, minutes or hours | 5 seconds |
APIs | Select APIs where the rate limit wil be applied | flight-api |
User groups | Name of the user group(s) which will be rate limited | crm-user |
Once you're done, select Create.
And done, the new rate limiting policy is created.
If you haven't done already, login into the Traefik Hub UI.
First, select API rate limits in the left navigation menu.
This is your overview page about all configured rate limits.
In the next step, select Create rate limit in the top right corner.
See the following configuration settings used in this example.
Field | Description | Example |
---|---|---|
Name | Name the new rate limit policy | distributed-rate-limiting |
Agent | the Traefik Hub agent where the API for the new rate limit policy is hosted | demo-agent |
Strategy | Select rate limit strategy | distributed |
Limit | Number of allowed requests pre defined time period | 100 |
Period | Time period can be seconds, minutes or hours | 5 seconds |
APIs | Select APIs where the rate limit wil be applied | flight-api |
User groups | Name of the user group(s) which will be rate limited | crm-user |
Once you're done, select Create.
And done, the new rate limiting policy is created.
Summary¶
In this article, you learned how to use the Traefik Hub UI to create and apply API rate limiting to an API.
Rate limiting is one of the fundamental aspects of API management.
What's next¶
- Learn how to apply rate limiting with CRDs.
- Learn how to configure and enable distributed rate limiting in Traefik Hub.