mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-12 13:33:51 +08:00
112 lines
1.7 KiB
Plaintext
112 lines
1.7 KiB
Plaintext
|
:8080
|
||
|
|
||
|
# With explicit wildcard matcher
|
||
|
route {
|
||
|
rewrite * /a
|
||
|
}
|
||
|
|
||
|
# With path matcher
|
||
|
route {
|
||
|
rewrite /path /b
|
||
|
}
|
||
|
|
||
|
# With named matcher
|
||
|
route {
|
||
|
@named method GET
|
||
|
rewrite @named /c
|
||
|
}
|
||
|
|
||
|
# With no matcher, assumed to be wildcard
|
||
|
route {
|
||
|
rewrite /d
|
||
|
}
|
||
|
----------
|
||
|
{
|
||
|
"apps": {
|
||
|
"http": {
|
||
|
"servers": {
|
||
|
"srv0": {
|
||
|
"listen": [
|
||
|
":8080"
|
||
|
],
|
||
|
"routes": [
|
||
|
{
|
||
|
"handle": [
|
||
|
{
|
||
|
"handler": "subroute",
|
||
|
"routes": [
|
||
|
{
|
||
|
"group": "group0",
|
||
|
"handle": [
|
||
|
{
|
||
|
"handler": "rewrite",
|
||
|
"uri": "/a"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"handler": "subroute",
|
||
|
"routes": [
|
||
|
{
|
||
|
"group": "group1",
|
||
|
"handle": [
|
||
|
{
|
||
|
"handler": "rewrite",
|
||
|
"uri": "/b"
|
||
|
}
|
||
|
],
|
||
|
"match": [
|
||
|
{
|
||
|
"path": [
|
||
|
"/path"
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"handler": "subroute",
|
||
|
"routes": [
|
||
|
{
|
||
|
"group": "group2",
|
||
|
"handle": [
|
||
|
{
|
||
|
"handler": "rewrite",
|
||
|
"uri": "/c"
|
||
|
}
|
||
|
],
|
||
|
"match": [
|
||
|
{
|
||
|
"method": [
|
||
|
"GET"
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"handler": "subroute",
|
||
|
"routes": [
|
||
|
{
|
||
|
"group": "group3",
|
||
|
"handle": [
|
||
|
{
|
||
|
"handler": "rewrite",
|
||
|
"uri": "/d"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|