docs: add extra routes
This commit is contained in:
76
docs/quickstart/extra-route.md
Normal file
76
docs/quickstart/extra-route.md
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
---
|
||||||
|
title: Extra Routes
|
||||||
|
layout: default
|
||||||
|
parent: Quickstart
|
||||||
|
nav_order: 5
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## Extra Routes
|
||||||
|
|
||||||
|
The Extra Routes feature allows you to define additional routes by using .yml or .yaml files stored in a specified directory.
|
||||||
|
|
||||||
|
This approach helps you avoid the complexity of managing all routes in a single file.
|
||||||
|
|
||||||
|
When dealing with many routes, maintaining them in one file can quickly become unwieldy. With this feature, you can organize your routes into separate files, making them easier to manage and maintain.
|
||||||
|
|
||||||
|
Example of an extra route
|
||||||
|
|
||||||
|
Create a file using `yaml` or `.yaml` extensions
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
routes:
|
||||||
|
- path: /order
|
||||||
|
name: order-service
|
||||||
|
hosts: []
|
||||||
|
rewrite: /
|
||||||
|
methods:
|
||||||
|
- GET
|
||||||
|
- PUT
|
||||||
|
backends:
|
||||||
|
- http://order-service:8080
|
||||||
|
- http://order-service2:8080
|
||||||
|
- http://order-service3:8080
|
||||||
|
healthCheck:
|
||||||
|
path: /
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
healthyStatuses:
|
||||||
|
- 200
|
||||||
|
- 404
|
||||||
|
cors:
|
||||||
|
origins: []
|
||||||
|
headers: {}
|
||||||
|
rateLimit: 60
|
||||||
|
disableHostFording: true
|
||||||
|
interceptErrors: [404,401]
|
||||||
|
blockCommonExploits: false
|
||||||
|
middlewares:
|
||||||
|
- auth-middleware
|
||||||
|
- path: /cart
|
||||||
|
name: cart-service
|
||||||
|
hosts: []
|
||||||
|
rewrite: /
|
||||||
|
methods:
|
||||||
|
- GET
|
||||||
|
- PUT
|
||||||
|
- POST
|
||||||
|
destination: http://cart-service:8080
|
||||||
|
healthCheck:
|
||||||
|
path: /
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
healthyStatuses:
|
||||||
|
- 200
|
||||||
|
- 404
|
||||||
|
cors:
|
||||||
|
origins: []
|
||||||
|
headers: {}
|
||||||
|
rateLimit: 60
|
||||||
|
disableHostFording: true
|
||||||
|
interceptErrors: [404,401]
|
||||||
|
blockCommonExploits: false
|
||||||
|
middlewares:
|
||||||
|
- auth-middleware
|
||||||
|
|
||||||
|
```
|
||||||
@@ -20,6 +20,11 @@ gateway:
|
|||||||
accessLog: /dev/Stdout
|
accessLog: /dev/Stdout
|
||||||
errorLog: /dev/stderr
|
errorLog: /dev/stderr
|
||||||
logLevel: info
|
logLevel: info
|
||||||
|
## Add additional routes
|
||||||
|
extraRoutes:
|
||||||
|
# path
|
||||||
|
directory: /etc/goma/extra
|
||||||
|
watch: true
|
||||||
disableRouteHealthCheckError: false
|
disableRouteHealthCheckError: false
|
||||||
disableDisplayRouteOnStart: false
|
disableDisplayRouteOnStart: false
|
||||||
disableKeepAlive: false
|
disableKeepAlive: false
|
||||||
@@ -36,6 +41,49 @@ gateway:
|
|||||||
Access-Control-Allow-Credentials: "true"
|
Access-Control-Allow-Credentials: "true"
|
||||||
Access-Control-Allow-Headers: Origin, Authorization, Accept, Content-Type, Access-Control-Allow-Headers, X-Client-Id, X-Session-Id
|
Access-Control-Allow-Headers: Origin, Authorization, Accept, Content-Type, Access-Control-Allow-Headers, X-Client-Id, X-Session-Id
|
||||||
Access-Control-Max-Age: "1728000"
|
Access-Control-Max-Age: "1728000"
|
||||||
routes:
|
routes: []
|
||||||
```
|
```
|
||||||
|
## Extra Routes
|
||||||
|
|
||||||
|
The Extra Routes feature allows you to define additional routes by using .yml or .yaml files stored in a specified directory.
|
||||||
|
|
||||||
|
This approach helps you avoid the complexity of managing all routes in a single file.
|
||||||
|
|
||||||
|
When dealing with many routes, maintaining them in one file can quickly become unwieldy. With this feature, you can organize your routes into separate files, making them easier to manage and maintain.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
version: 1.0
|
||||||
|
gateway:
|
||||||
|
sslCertFile: /etc/goma/cert.pem
|
||||||
|
sslKeyFile: /etc/goma/key.pem
|
||||||
|
writeTimeout: 15
|
||||||
|
readTimeout: 15
|
||||||
|
idleTimeout: 30
|
||||||
|
# Rate limiting
|
||||||
|
rateLimit: 0
|
||||||
|
accessLog: /dev/Stdout
|
||||||
|
errorLog: /dev/stderr
|
||||||
|
logLevel: info
|
||||||
|
## Add additional routes
|
||||||
|
extraRoutes:
|
||||||
|
# path
|
||||||
|
directory: /etc/goma/extra
|
||||||
|
watch: true
|
||||||
|
disableRouteHealthCheckError: false
|
||||||
|
disableDisplayRouteOnStart: false
|
||||||
|
disableKeepAlive: false
|
||||||
|
disableHealthCheckStatus: false
|
||||||
|
blockCommonExploits: true
|
||||||
|
# Intercept backend errors
|
||||||
|
interceptErrors:
|
||||||
|
- 500
|
||||||
|
cors:
|
||||||
|
origins:
|
||||||
|
- http://localhost:8080
|
||||||
|
- https://example.com
|
||||||
|
headers:
|
||||||
|
Access-Control-Allow-Credentials: "true"
|
||||||
|
Access-Control-Allow-Headers: Origin, Authorization, Accept, Content-Type, Access-Control-Allow-Headers, X-Client-Id, X-Session-Id
|
||||||
|
Access-Control-Max-Age: "1728000"
|
||||||
|
routes: []
|
||||||
|
```
|
||||||
@@ -20,6 +20,11 @@ gateway:
|
|||||||
#redis:
|
#redis:
|
||||||
#addr: redis:6379
|
#addr: redis:6379
|
||||||
# password: password
|
# password: password
|
||||||
|
## Add additional routes
|
||||||
|
extraRoutes:
|
||||||
|
# path
|
||||||
|
directory: /etc/goma/extra
|
||||||
|
watch: true
|
||||||
## Enable, disable routes health check
|
## Enable, disable routes health check
|
||||||
disableHealthCheckStatus: false
|
disableHealthCheckStatus: false
|
||||||
## Returns backend route healthcheck errors
|
## Returns backend route healthcheck errors
|
||||||
|
|||||||
Reference in New Issue
Block a user