From 25af3d9fdfa6278bb0f078a3c59c1bf5a3c80556 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 23 Aug 2026 17:42:44 -0700 Subject: [PATCH] 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'. --- dankclaw/Caddyfile | 2 +- tests/homepage_caddy.bats | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dankclaw/Caddyfile b/dankclaw/Caddyfile index f5a5cd2..a14d157 100644 --- a/dankclaw/Caddyfile +++ b/dankclaw/Caddyfile @@ -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 } diff --git a/tests/homepage_caddy.bats b/tests/homepage_caddy.bats index 50bfe01..0a30ff5 100644 --- a/tests/homepage_caddy.bats +++ b/tests/homepage_caddy.bats @@ -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" }