-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Open
Labels
discussion 💬The right solution needs to be foundThe right solution needs to be found
Description
Looking at https://caddyserver.com/docs/caddyfile/directives/redir#syntax, it seems as if the matcher is optional according to the examples.
Yet, trying to use it without a matcher does not work (both caddy run and caddy validate complain).
This works:
...
handle_errors {
@404 {
expression `{err.status_code} == 404`
}
handle @404 {
redir * /subdir/index.html
}
# Any other kind of error should be passed through
handle {
respond "Internal http server error: {err.trace}"
}
}changing the redir line to redir /subdir/index.html leads to the following issue:
Error: adapting config using caddyfile: parsing caddyfile tokens for 'handle_errors': parsing caddyfile tokens for 'handle': parsing caddyfile tokens for 'redir': wrong argument count or unexpected line ending after 'redir', at Caddyfile:41, at Caddyfile:42, at Caddyfile:48
Yet, the doc shows 3 out of 4 examples without a matcher:
I guess the syntax doc should explain that a bit better, shouldn't it?
FYI:
caddy version:v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=
Metadata
Metadata
Assignees
Labels
discussion 💬The right solution needs to be foundThe right solution needs to be found
