Hi all!
1. The problem I’m having:
I try to reproduce the examples in the documentation for path_regexp (Request matchers (Caddyfile) — Caddy Documentation). The first two example work, but the third entry produces an error i do not understand. The entry is:
@static `path_regexp('\.([a-f0-9]{6})\.(css|js)$') && file()`
2. Error messages and/or full log output:
Caddy does not start any more log output (with docker compose logs) is:
caddy-1 | {"level":"info","ts":1749055527.8660698,"msg":"maxprocs: Leaving GOMAXPROCS=4: CPU quota undefined"}
caddy-1 | {"level":"info","ts":1749055527.8662655,"msg":"GOMEMLIMIT is updated","package":"github.com/KimMachineGun/automemlimit/memlimit","GOMEMLIMIT":3758340096,"previous":9223372036854775807}
caddy-1 | {"level":"info","ts":1749055527.8663309,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}
caddy-1 | {"level":"info","ts":1749055527.8670762,"msg":"adapted config to JSON","adapter":"caddyfile"}
caddy-1 | {"level":"info","ts":1749055527.868077,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
caddy-1 | {"level":"info","ts":1749055527.8682792,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0x4000527e80"}
caddy-1 | {"level":"info","ts":1749055527.8723888,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0x4000527e80"}
caddy-1 | {"level":"info","ts":1749055527.8724382,"msg":"maxprocs: No GOMAXPROCS change to reset"}
caddy-1 | Error: loading initial config: loading new config: loading http app module: provision http: server srv0: setting up route matchers: route 0: loading matcher modules: module name 'expression': provision http.matchers.expression: compiling CEL program: ERROR: <input>:1:13: Syntax error: token recognition error at: ''\.'
caddy-1 | | path_regexp('\.([a-f0-9]{6})\.(css|js)$') && file()
caddy-1 | | ............^
caddy-1 | ERROR: <input>:1:17: matcher argument must be a string literal
caddy-1 | | path_regexp('\.([a-f0-9]{6})\.(css|js)$') && file()
caddy-1 | | ................^
caddy-1 | ERROR: <input>:1:25: Syntax error: mismatched input '{' expecting ')'
caddy-1 | | path_regexp('\.([a-f0-9]{6})\.(css|js)$') && file()
caddy-1 | | ........................^
caddy-1 | ERROR: <input>:1:29: Syntax error: token recognition error at: '\'
caddy-1 | | path_regexp('\.([a-f0-9]{6})\.(css|js)$') && file()
caddy-1 | | ............................^
caddy-1 | ERROR: <input>:1:31: Syntax error: no viable alternative at input '.('
caddy-1 | | path_regexp('\.([a-f0-9]{6})\.(css|js)$') && file()
caddy-1 | | ..............................^
caddy-1 | ERROR: <input>:1:35: Syntax error: token recognition error at: '|j'
caddy-1 | | path_regexp('\.([a-f0-9]{6})\.(css|js)$') && file()
caddy-1 | | ..................................^
caddy-1 | ERROR: <input>:1:39: Syntax error: token recognition error at: '$'
caddy-1 | | path_regexp('\.([a-f0-9]{6})\.(css|js)$') && file()
caddy-1 | | ......................................^
caddy-1 | ERROR: <input>:1:40: Syntax error: token recognition error at: '') && file()'
caddy-1 | | path_regexp('\.([a-f0-9]{6})\.(css|js)$') && file()
caddy-1 | | .......................................^
3. Caddy version:
docker compose exec caddy caddy version
v2.10.0 h1:fonubSaQKF1YANl8TXqGcn4IbIRUDdfAkpcsfI/vX5U=
4. How I installed and ran Caddy:
a. System environment:
uname -a
Linux rpi5b 6.12.22-current-bcm2711 #1 SMP PREEMPT Wed Apr 23 13:38:58 UTC 2025 aarch64 GNU/Linux
cat /etc/debian_version
12.10
docker --version
Docker version 28.2.2, build e6534b4
b. Command:
docker compose start
c. Service/unit/compose file:
name: "test"
services:
caddy:
image: caddy:latest
ports:
- "80:80"
volumes:
- ./data:/data
- ./Caddyfile:/etc/caddy/Caddyfile
d. My complete Caddy config:
:80 {
@static `path_regexp('\.([a-f0-9]{6})\.(css|js)$') && file()`
respond @static "Does not work"
}