Caddyfile: fix the /admin/ rewrite (matcher follows the directive)
'@admin rewrite ...' is parsed as a one-liner matcher DEFINITION, so it
re-defined @admin and Caddy rejected the config ('matcher is defined more
than once'), crash-looping the container. Per the Caddyfile matcher docs the
matcher token is the first ARGUMENT after the directive: 'rewrite @admin
/admin.html'. The '*' disambiguator is only needed pre-2.8.0. Validated the
rendered config against the porkbun image: 'Valid configuration'.
This commit is contained in:
+1
-1
@@ -54,7 +54,7 @@ dankclaw.franksdank.cloud {
|
||||
basicauth @admin {
|
||||
frank REPLACE_WITH_ADMIN_HASH
|
||||
}
|
||||
@admin rewrite * /admin.html
|
||||
rewrite @admin /admin.html
|
||||
root * /srv/homepage
|
||||
file_server
|
||||
}
|
||||
|
||||
@@ -26,5 +26,8 @@ setup() {
|
||||
}
|
||||
|
||||
@test "the /admin/ path is rewritten to admin.html" {
|
||||
grep -qE "@admin[[:space:]]+rewrite[[:space:]]+\*[[:space:]]+/admin.html" "$CADDY"
|
||||
# The matcher token follows the directive (rewrite @admin ...), per the
|
||||
# Caddyfile matcher docs. A leading '@admin rewrite' is parsed as a
|
||||
# one-liner matcher DEFINITION and re-defines @admin (invalid).
|
||||
grep -qE "rewrite[[:space:]]+@admin[[:space:]]+/admin.html" "$CADDY"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user