From 79e14dcf8488e86aeb3ebcca4060fcacfd1a0303 Mon Sep 17 00:00:00 2001 From: Agent Date: Tue, 21 Apr 2026 11:17:27 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20add=20uri=20strip=5Fprefix=20/forge=20to?= =?UTF-8?q?=20Caddyfile=20generator=20=E2=80=94=20Forgejo=20routes=20404?= =?UTF-8?q?=20without=20it=20(completes=20#1080)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The /forge/* handle block in the Caddyfile generator was missing the "uri strip_prefix /forge" directive. Without it, Caddy forwards /forge/foo → forgejo:3000/forge/foo, Forgejo's router doesn't match, and returns 404. Adding strip_prefix makes the prefix transparent to Forgejo while ROOT_URL still governs link generation in HTML. Also fixes nomad/jobs/edge.hcl (Nomad-rendered Caddyfile template) and .woodpecker/edge-subpath.yml (CI mock Caddyfile) for consistency. Same pattern as the /staging/* strip_prefix added in #1079. Co-Authored-By: Claude Opus 4.6 --- .woodpecker/edge-subpath.yml | 1 + lib/generators.sh | 1 + nomad/jobs/edge.hcl | 1 + 3 files changed, 3 insertions(+) diff --git a/.woodpecker/edge-subpath.yml b/.woodpecker/edge-subpath.yml index 2c11980..f9c874a 100644 --- a/.woodpecker/edge-subpath.yml +++ b/.woodpecker/edge-subpath.yml @@ -59,6 +59,7 @@ steps: echo '' echo ' # Reverse proxy to Forgejo' echo ' handle /forge/* {' + echo ' uri strip_prefix /forge' echo ' reverse_proxy 127.0.0.1:3000' echo ' }' echo '' diff --git a/lib/generators.sh b/lib/generators.sh index 67ff830..9efd360 100644 --- a/lib/generators.sh +++ b/lib/generators.sh @@ -860,6 +860,7 @@ _generate_caddyfile_subpath() { # Reverse proxy to Forgejo handle /forge/* { + uri strip_prefix /forge reverse_proxy forgejo:3000 } diff --git a/nomad/jobs/edge.hcl b/nomad/jobs/edge.hcl index 67c474c..9371768 100644 --- a/nomad/jobs/edge.hcl +++ b/nomad/jobs/edge.hcl @@ -151,6 +151,7 @@ EOT # Reverse proxy to Forgejo handle /forge/* { + uri strip_prefix /forge reverse_proxy 127.0.0.1:3000 } -- 2.49.1