How-To: Rate limiting

Use Dapr rate limit middleware to limit requests per second

The Dapr Rate limit HTTP middleware allows restricting the maximum number of allowed HTTP requests per second.

Middleware component definition

In the following definition, the maximum requests per second are set to 10:

kind: Component
  name: ratelimit
  type: middleware.http.ratelimit
  - name: maxRequestsPerSecond
    value: 10

Once the limit is reached, the request will return HTTP Status code 429: Too Many Requests.

Referencing the rate limit middleware

To be applied, the middleware must be referenced in a Dapr Configuration. See Middleware pipelines.

Last modified January 30, 2021: Update (#1118) (10c2d21)