mirror of https://github.com/dapr/docs.git
commit
35bbdd5fcb
|
@ -61,7 +61,7 @@ npm install
|
|||
```sh
|
||||
hugo server --disableFastRender
|
||||
```
|
||||
3. Navigate to `http://localhost:1313/docs`
|
||||
3. Navigate to `http://localhost:1313/`
|
||||
|
||||
## Update docs
|
||||
1. Fork repo into your account
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
type: docs
|
||||
title: "How-To: Rate limiting"
|
||||
linkTitle: "How-To: Rate limiting"
|
||||
weight: 1000
|
||||
description: "Use Dapr rate limit middleware to limit requests per second"
|
||||
type: docs
|
||||
---
|
||||
|
||||
The Dapr Rate limit [HTTP middleware]({{< ref middleware-concept.md >}}) 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:
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: ratelimit
|
||||
spec:
|
||||
type: middleware.http.ratelimit
|
||||
metadata:
|
||||
- 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]({{< ref configuration-concept.md >}}). See [Middleware pipelines]({{< ref "middleware-concept.md#customize-processing-pipeline">}}).
|
Loading…
Reference in New Issue