fix: add uri strip_prefix /forge to Caddyfile generator — Forgejo routes 404 without it (completes #1080) #1103
Labels
No labels
action
backlog
blocked
bug-report
cannot-reproduce
in-progress
in-triage
needs-triage
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
rejected
reproduced
tech-debt
underspecified
vision
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#1103
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Goal
Complete the
/forge/subpath routing that #1080 partially addressed. The merged fix setFORGEJO__server__ROOT_URL=http://forgejo:3000/forge/but omitted the requireduri strip_prefix /forgedirective in the Caddy handle block. Result: Forgejo still returns 404 for/forge/*because it doesn't natively re-route prefixed paths — it relies on the reverse proxy to strip the prefix while ROOT_URL governs link generation in rendered HTML.Evidence
Verified on disinto-dev-box 2026-04-21 after rebuilding edge with current main:
Caddy forwards
/forge/foo→forgejo:3000/forge/foo, Forgejo's router doesn't match, returns 404. Addinguri strip_prefix /forgein the Caddy handle block fixed it live:Same pattern as the already-merged
/staging/strip (#1079). Forgejo's ROOT_URL still governs link generation, so internal HTML links continue to say/forge/*— the round-trip works.The fix
In
lib/generators.sh(canonical Caddyfile generator), locate the/forge/*handle block:Add the strip_prefix line:
Same exact pattern as the staging block already has (post #1079).
Acceptance criteria
lib/generators.sh/forge/*handle block includesuri strip_prefix /forgeimmediately beforereverse_proxycurl http://localhost/forge/returns 200 (not 404)curl http://localhost/forge/api/v1/versionreturns 200 with a version JSON responsecurl -IL http://localhost/forge/user/loginreturns 200, no redirect loop/forge/-prefixed internal links (confirms ROOT_URL still governs link generation):curl http://localhost/forge/ | grep -c 'href="/forge'> 0tests/smoke-edge-subpath.shTest 2 passes against live edge/staging/(#1079) or/ci/pathsshellcheckclean onlib/generators.shAffected files
lib/generators.sh—/forge/*handle blockdocker/Caddyfile(if tracked and used as a template) — mirror the changeRelated
FORGEJO__server__ROOT_URLenv change, merged but incomplete. This issue completes it./staging/strip_prefix, already merged; same pattern to apply here.Blocked — issue #1103
ci_exhausted2026-04-21T11:29:30ZBlocked — issue #1103
closed_externally2026-04-21T16:06:57Z