mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-12 21:43:56 +08:00
3e1fd2a8d4
* httpcaddyfile: Wrap site block in subroute if host matcher used (fix #5124) * Correct boolean logic (oops)
127 lines
2.8 KiB
Plaintext
127 lines
2.8 KiB
Plaintext
:8884
|
|
|
|
# the use of a host matcher here should cause this
|
|
# site block to be wrapped in a subroute, even though
|
|
# the site block does not have a hostname; this is
|
|
# to prevent auto-HTTPS from picking up on this host
|
|
# matcher because it is not a key on the site block
|
|
@test host example.com
|
|
php_fastcgi @test localhost:9000
|
|
----------
|
|
{
|
|
"apps": {
|
|
"http": {
|
|
"servers": {
|
|
"srv0": {
|
|
"listen": [
|
|
":8884"
|
|
],
|
|
"routes": [
|
|
{
|
|
"handle": [
|
|
{
|
|
"handler": "subroute",
|
|
"routes": [
|
|
{
|
|
"handle": [
|
|
{
|
|
"handler": "subroute",
|
|
"routes": [
|
|
{
|
|
"handle": [
|
|
{
|
|
"handler": "static_response",
|
|
"headers": {
|
|
"Location": [
|
|
"{http.request.orig_uri.path}/"
|
|
]
|
|
},
|
|
"status_code": 308
|
|
}
|
|
],
|
|
"match": [
|
|
{
|
|
"file": {
|
|
"try_files": [
|
|
"{http.request.uri.path}/index.php"
|
|
]
|
|
},
|
|
"not": [
|
|
{
|
|
"path": [
|
|
"*/"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"handle": [
|
|
{
|
|
"handler": "rewrite",
|
|
"uri": "{http.matchers.file.relative}"
|
|
}
|
|
],
|
|
"match": [
|
|
{
|
|
"file": {
|
|
"split_path": [
|
|
".php"
|
|
],
|
|
"try_files": [
|
|
"{http.request.uri.path}",
|
|
"{http.request.uri.path}/index.php",
|
|
"index.php"
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"handle": [
|
|
{
|
|
"handler": "reverse_proxy",
|
|
"transport": {
|
|
"protocol": "fastcgi",
|
|
"split_path": [
|
|
".php"
|
|
]
|
|
},
|
|
"upstreams": [
|
|
{
|
|
"dial": "localhost:9000"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"match": [
|
|
{
|
|
"path": [
|
|
"*.php"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"match": [
|
|
{
|
|
"host": [
|
|
"example.com"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"terminal": true
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |