mirror of https://github.com/dapr/docs.git
Update docs for rate limit HTTP middleware (#3263)
* Update docs for Ratelimit HTTP middleware Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com> * Spelling Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com> --------- Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
parent
d8672a9aeb
commit
e515841e93
|
@ -7,11 +7,12 @@ aliases:
|
||||||
- /developing-applications/middleware/supported-middleware/middleware-rate-limit/
|
- /developing-applications/middleware/supported-middleware/middleware-rate-limit/
|
||||||
---
|
---
|
||||||
|
|
||||||
The rate limit [HTTP middleware]({{< ref middleware.md >}}) 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).
|
The rate limit [HTTP middleware]({{< ref middleware.md >}}) 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).
|
||||||
|
|
||||||
## Component format
|
## Component format
|
||||||
|
|
||||||
In the following definition, the maximum requests per second are set to 10:
|
In the following definition, the maximum requests per second are set to 10:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: dapr.io/v1alpha1
|
apiVersion: dapr.io/v1alpha1
|
||||||
kind: Component
|
kind: Component
|
||||||
|
@ -29,11 +30,15 @@ spec:
|
||||||
|
|
||||||
| Field | Details | Example |
|
| Field | Details | Example |
|
||||||
|-------|---------|---------|
|
|-------|---------|---------|
|
||||||
| 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** | `10`
|
| `maxRequestsPerSecond` | The maximum requests per second by remote IP.<br>The component looks at the `X-Forwarded-For` and `X-Real-IP` headers to determine the caller's IP. | `10`
|
||||||
|
|
||||||
Once the limit is reached, the request will return *HTTP Status code 429: Too Many Requests*.
|
Once the limit is reached, the requests will fail with HTTP Status code *429: Too Many Requests*.
|
||||||
|
|
||||||
Alternatively, the [max concurrency setting]({{< ref control-concurrency.md >}}) can be used to rate limit applications and applies to all traffic regardless of remote IP or path.
|
{{% alert title="Important" color="warning" %}}
|
||||||
|
The rate limit is enforced independently in each Dapr sidecar, and not cluster-wide.
|
||||||
|
{{% /alert %}}
|
||||||
|
|
||||||
|
Alternatively, the [max concurrency setting]({{< ref control-concurrency.md >}}) can be used to rate limit applications and applies to all traffic, regardless of remote IP, protocol, or path.
|
||||||
|
|
||||||
## Dapr configuration
|
## Dapr configuration
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
- component: Rate limit
|
- component: Rate limit
|
||||||
link: middleware-rate-limit
|
link: middleware-rate-limit
|
||||||
state: Alpha
|
state: Stable
|
||||||
version: v1
|
version: v1
|
||||||
description: Restricts the maximum number of allowed HTTP requests per second
|
description: Restricts the maximum number of allowed HTTP requests per second
|
||||||
- component: OAuth2 Authorization Grant flow
|
- component: OAuth2 Authorization Grant flow
|
||||||
|
|
Loading…
Reference in New Issue