1. The problem I’m having:
I’m trying to match paths by regexp and respond with data from its captured groups.
While other placeholders work, those for captured groups just output {http.regexp…}
.
2. Error messages and/or full log output:
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Server: Caddy
X-Numbers-Header: You requested the number {http.regexp.numbers.1} from darwin
Date: Mon, 22 Apr 2024 23:20:27 GMT
Content-Length: 60
You requested the number {http.regexp.numbers.1} from darwin
3. Caddy version:
v2.7.6
4. How I installed and ran Caddy:
a. System environment:
Via Homebrew on macOS Sonoma.
b. Command:
caddy run
c. Service/unit/compose file:
N/A
d. My complete Caddy config:
:6789
@numbers path_regexp /numbers/(\d+)
route @numbers {
header {
X-Numbers-Header "You requested the number {re.numbers.1} from {system.os}"
}
respond "You requested the number {re.numbers.1} from {system.os}"
}