The documentation you are viewing is for Dapr v1.8 which is an older version of Dapr. For up-to-date documentation, see the latest version.
The rate limit HTTP middleware allows restricting the maximum number of allowed HTTP requests per second. Rate limiting can protect your application from denial of service (DOS) attacks. DOS attacks can be initiated by malicious 3rd parties but also by bugs in your software (a.k.a. a “friendly fire” DOS attack).
In the following definition, the maximum requests per second are set to 10:
apiVersion: dapr.io/v1alpha1 kind: Component metadata: name: ratelimit spec: type: middleware.http.ratelimit version: v1 metadata: - name: maxRequestsPerSecond value: 10
Spec metadata fields
|maxRequestsPerSecond||The maximum requests per second by remote IP and path. Something to consider is that the limit is enforced independently in each Dapr sidecar and not cluster wide||
Once the limit is reached, the request will return HTTP Status code 429: Too Many Requests.
Alternatively, the max concurrency setting can be used to rate limit applications and applies to all traffic regardless of remote IP or path.
apiVersion: dapr.io/v1alpha1 kind: Configuration metadata: name: appconfig spec: httpPipeline: handlers: - name: ratelimit type: middleware.http.ratelimit
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.