The documentation you are viewing is for Dapr v0.11 which is an older version of Dapr. For up-to-date documentation, see the latest version.

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.