docs: update rate limiting
This commit is contained in:
@@ -10,13 +10,35 @@ nav_order: 6
|
|||||||
|
|
||||||
The RateLimit middleware ensures that services will receive a fair number of requests, and allows one to define what fair is.
|
The RateLimit middleware ensures that services will receive a fair number of requests, and allows one to define what fair is.
|
||||||
|
|
||||||
Example of global rateLimit middleware
|
Example of rate limiting middleware
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
middlewares:
|
||||||
|
- name: rate-limit
|
||||||
|
type: ratelimit #or rateLimit
|
||||||
|
paths:
|
||||||
|
- /*
|
||||||
|
rule:
|
||||||
|
unit: minute # or hour
|
||||||
|
requestsPerUnit: 10
|
||||||
|
```
|
||||||
|
|
||||||
|
Example of route rate limiting middleware
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
version: 0.1.7
|
||||||
|
gateway:
|
||||||
|
routes:
|
||||||
|
- name: Example
|
||||||
|
rateLimit: 60 # peer minute
|
||||||
|
```
|
||||||
|
|
||||||
|
Example of global rate limiting middleware
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: 0.1.7
|
version: 0.1.7
|
||||||
gateway:
|
gateway:
|
||||||
# Proxy rate limit, it's In-Memory IP based
|
|
||||||
rateLimit: 60 # peer minute
|
rateLimit: 60 # peer minute
|
||||||
routes:
|
routes:
|
||||||
- name: Example
|
- name: Example
|
||||||
```
|
```
|
||||||
@@ -42,7 +42,7 @@ type Route struct {
|
|||||||
HealthCheck RouteHealthCheck `yaml:"healthCheck"`
|
HealthCheck RouteHealthCheck `yaml:"healthCheck"`
|
||||||
// Cors contains the route cors headers
|
// Cors contains the route cors headers
|
||||||
Cors Cors `yaml:"cors"`
|
Cors Cors `yaml:"cors"`
|
||||||
RateLimit int `yaml:"rateLimit"`
|
RateLimit int `yaml:"rateLimit,omitempty"`
|
||||||
// DisableHostFording Disable X-forwarded header.
|
// DisableHostFording Disable X-forwarded header.
|
||||||
//
|
//
|
||||||
// [X-Forwarded-Host, X-Forwarded-For, Host, Scheme ]
|
// [X-Forwarded-Host, X-Forwarded-For, Host, Scheme ]
|
||||||
|
|||||||
Reference in New Issue
Block a user