The following Caddyfile:
&(named) {
vars Test {header.test}
}
example.com {
invoke named
vars Test {header.test}
}
Produces the following config:
{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":443"
],
"routes": [
{
"match": [
{
"host": [
"example.com"
]
}
],
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"Test": "{http.request.header.test}",
"handler": "vars"
},
{
"handler": "invoke",
"name": "named"
}
]
}
]
}
],
"terminal": true
}
],
"named_routes": {
"named": {
"handle": [
{
"Test": "{header.test}",
"handler": "vars"
}
]
}
}
}
}
}
}
}
I see that named routes are still an experimental feature, so I'm not sure if this behavior is intentional or a known limitation.
If this is not a bug, I think it would be helpful to call out in the documentation. It took me while to debug why my placeholders were not working as I would have expected.
The following Caddyfile:
Produces the following config:
{ "apps": { "http": { "servers": { "srv0": { "listen": [ ":443" ], "routes": [ { "match": [ { "host": [ "example.com" ] } ], "handle": [ { "handler": "subroute", "routes": [ { "handle": [ { "Test": "{http.request.header.test}", "handler": "vars" }, { "handler": "invoke", "name": "named" } ] } ] } ], "terminal": true } ], "named_routes": { "named": { "handle": [ { "Test": "{header.test}", "handler": "vars" } ] } } } } } } }I see that named routes are still an experimental feature, so I'm not sure if this behavior is intentional or a known limitation.
If this is not a bug, I think it would be helpful to call out in the documentation. It took me while to debug why my placeholders were not working as I would have expected.