docs: update middleware example
This commit is contained in:
@@ -29,7 +29,7 @@ Example of access middleware
|
|||||||
```yaml
|
```yaml
|
||||||
routes:
|
routes:
|
||||||
- path: /protected
|
- path: /protected
|
||||||
name: Basic auth
|
name: protected
|
||||||
rewrite: /
|
rewrite: /
|
||||||
destination: 'https://example.com'
|
destination: 'https://example.com'
|
||||||
methods: [POST, PUT, GET]
|
methods: [POST, PUT, GET]
|
||||||
|
|||||||
@@ -9,33 +9,32 @@ nav_order: 3
|
|||||||
# Basic Auth Middleware
|
# Basic Auth Middleware
|
||||||
|
|
||||||
|
|
||||||
Access middleware prevents access to a route or specific route path.
|
Basic-auth middleware protects route paths.
|
||||||
|
|
||||||
Example of access middleware
|
Example of basic-auth middleware
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# The server will return 403
|
middlewares:
|
||||||
- name: api-forbidden-paths
|
- name: basic-auth
|
||||||
type: access
|
type: basic
|
||||||
## prevents access paths
|
|
||||||
paths:
|
paths:
|
||||||
- /swagger-ui/*
|
- /admin/*
|
||||||
- /v2/swagger-ui/*
|
rule:
|
||||||
- /api-docs/*
|
username: admin
|
||||||
- /internal/*
|
password: admin
|
||||||
- /actuator/*
|
|
||||||
```
|
```
|
||||||
### Apply access middleware on the route
|
### Apply basic-auth middleware to the route
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
routes:
|
routes:
|
||||||
- path: /protected
|
- path: /
|
||||||
name: Basic auth
|
name: Basic-auth
|
||||||
rewrite: /
|
rewrite: /
|
||||||
destination: 'https://example.com'
|
destination: https://example.com
|
||||||
methods: [POST, PUT, GET]
|
methods: [POST, PUT, GET]
|
||||||
healthCheck:
|
healthCheck: {}
|
||||||
cors: {}
|
cors: {}
|
||||||
middlewares:
|
middlewares:
|
||||||
- api-forbidden-paths
|
- basic-auth
|
||||||
```
|
```
|
||||||
@@ -90,8 +90,8 @@ Example of rateLimit middleware
|
|||||||
```yaml
|
```yaml
|
||||||
##### Define routes
|
##### Define routes
|
||||||
routes:
|
routes:
|
||||||
- name: Basic auth
|
- path: /protected
|
||||||
path: /protected
|
name: oauth-route
|
||||||
rewrite: /
|
rewrite: /
|
||||||
destination: 'https://example.com'
|
destination: 'https://example.com'
|
||||||
methods: [POST, PUT, GET]
|
methods: [POST, PUT, GET]
|
||||||
|
|||||||
Reference in New Issue
Block a user