fix(caddy): wrap actuator block in handle so it takes precedence over catch-all (#512)
#517
Reference in New Issue
Block a user
Delete Branch "fix/issue-512-caddy-actuator-block-handle"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Closes #512.
The
(block_actuator)Caddyfile snippet emittedrespond @actuator 404at the top level of each archive vhost. But each vhost also has a catch-allhandle { reverse_proxy ... }. Caddy'shandleblocks are mutually exclusive — once ahandlematches, the request never reaches a top-levelrespond. The catch-all swallowed/actuator/*and proxied it to the backend, which Spring-Security'd 302 to/login.Fix
Wrap the snippet body in
handle /actuator/* { respond 404 }. Caddy sortshandleblocks by path specificity, so/actuator/*wins over the catch-all and the 404 is actually returned.Verified locally
docker run --rm -v ./infra/caddy/Caddyfile:/etc/caddy/Caddyfile:ro caddy:2 caddy validate→ Valid configurationTest plan after merge
cd /opt/familienarchiv && git pull && systemctl reload caddyon the hostcurl -o /dev/null -w "%{http_code}" https://staging.raddatz.cloud/actuator/health→ 404 (was 302)nightly.ymlsmoke step's/actuator/health → 404assertion passes/api/...and/routes are still proxied normally (the newhandleblock must not shadow anything else —/actuator/*is a strict prefix)Notes
HTTP 302instead ofHTTP 404. After this merge it'll be the documented behavior.🤖 Generated with Claude Code
handleso it takes precedence over catch-all