docs: update middleware example

This commit is contained in:
Jonas Kaninda
2024-11-20 07:57:15 +01:00
parent ece8f57596
commit 1c1353e3a5
3 changed files with 19 additions and 20 deletions

View File

@@ -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]

View File

@@ -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
``` ```

View File

@@ -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]