added path to routing
This commit is contained in:
parent
7fd2531501
commit
85e29b8734
4 changed files with 84 additions and 30 deletions
23
API.md
23
API.md
|
|
@ -69,6 +69,20 @@ Default bind: `127.0.0.1:9911`
|
|||
}
|
||||
```
|
||||
|
||||
### Create app (multiple routes, different ports, with paths)
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "pocketbase",
|
||||
"routes": [
|
||||
{"domain": "pb.srazka.com", "upstream": "127.0.0.1:8090", "path": "/_/*"}
|
||||
],
|
||||
"auth": true
|
||||
}
|
||||
```
|
||||
|
||||
The `path` field is optional. When present, it generates a Caddy `reverse_proxy /_/* 127.0.0.1:8090` rule, letting you route requests to a specific path prefix within a domain.
|
||||
|
||||
### Create app (wildcard domain)
|
||||
|
||||
```json
|
||||
|
|
@ -89,11 +103,14 @@ Note: Wildcard domains require DNS challenge configuration in Caddy.
|
|||
{
|
||||
"routes": [
|
||||
{"domain": "app.srazka.com", "upstream": "127.0.0.1:18080"},
|
||||
{"domain": "api.srazka.com", "upstream": "127.0.0.1:18081"}
|
||||
{"domain": "api.srazka.com", "upstream": "127.0.0.1:18081"},
|
||||
{"domain": "pb.srazka.com", "upstream": "127.0.0.1:8090", "path": "/_/*"}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The optional `path` field generates a Caddy `reverse_proxy <path> <upstream>` rule for sub-path routing.
|
||||
|
||||
Caddy reloads automatically via the systemd path watcher. Containers stay running.
|
||||
|
||||
### Save compose
|
||||
|
|
@ -128,11 +145,13 @@ Caddy reloads automatically via the systemd path watcher. Containers stay runnin
|
|||
"name": "myapp",
|
||||
"routes": [
|
||||
{"domain": "app.srazka.com", "upstream": "127.0.0.1:18080"},
|
||||
{"domain": "api.srazka.com", "upstream": "127.0.0.1:18081"}
|
||||
{"domain": "api.srazka.com", "upstream": "127.0.0.1:18081", "path": "/api/*"}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The `path` field is only present when a route has a path configured.
|
||||
|
||||
## Response format
|
||||
|
||||
All JSON responses include an `ok` boolean:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue