Merge pull request 'fix: fix: strip /staging prefix in Caddyfile before proxying to staging container (#1079)' (#1081) from fix/issue-1079 into main
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/push/nomad-validate Pipeline was successful

This commit is contained in:
dev-qwen2 2026-04-20 15:22:27 +00:00
commit 398a7398a9
3 changed files with 9 additions and 0 deletions

View file

@ -860,6 +860,7 @@ _generate_caddyfile_subpath() {
# Reverse proxy to staging # Reverse proxy to staging
handle /staging/* { handle /staging/* {
uri strip_prefix /staging
reverse_proxy staging:80 reverse_proxy staging:80
} }

View file

@ -161,6 +161,7 @@ EOT
# Reverse proxy to staging dynamic port via Nomad service discovery # Reverse proxy to staging dynamic port via Nomad service discovery
handle /staging/* { handle /staging/* {
uri strip_prefix /staging
{{ range nomadService "staging" }} reverse_proxy {{ .Address }}:{{ .Port }} {{ range nomadService "staging" }} reverse_proxy {{ .Address }}:{{ .Port }}
{{ end }} } {{ end }} }

View file

@ -125,6 +125,13 @@ check_staging_routing() {
tr_fail "Missing Staging handle block (handle /staging/*)" tr_fail "Missing Staging handle block (handle /staging/*)"
fi fi
# Check for uri strip_prefix /staging directive
if echo "$CADDYFILE" | grep -q "uri strip_prefix /staging"; then
tr_pass "Staging uri strip_prefix configured (/staging)"
else
tr_fail "Missing uri strip_prefix /staging for staging"
fi
# Check for nomadService discovery (dynamic port) # Check for nomadService discovery (dynamic port)
if echo "$CADDYFILE" | grep -q "nomadService"; then if echo "$CADDYFILE" | grep -q "nomadService"; then
tr_pass "Staging uses Nomad service discovery" tr_pass "Staging uses Nomad service discovery"