fix: correct traefik route label escaping

Path-based route rules for traefik kept a stray backslash before each backtick, so traefik rejected the router and requests fell through to the web process. The nginx template tests now also supply the route variables and cover route rendering.
This commit is contained in:
Jose Diaz-Gonzalez
2026-11-05 01:36:10 -05:00
parent fb7d0f57bf
commit ffcc60709a
3 changed files with 55 additions and 9 deletions

View File

@@ -23,8 +23,7 @@ fn-traefik-route-labels() {
service_name="${APP}-${route_proc}-${route_slug}"
path_len="${#route_path}"
# Triple-backslash for the same eval-survival reason as fn-traefik-host-rule.
local rule="PathPrefix(\\\`${route_path}\\\`)"
local rule="PathPrefix(\`${route_path}\`)"
if [[ -n "$host_rule" ]]; then
rule="(${host_rule}) && ${rule}"
fi
@@ -78,17 +77,12 @@ fn-traefik-host-rule() {
return
fi
# Backticks must be double-escaped so they survive the docker-args eval
# path. A single backslash leaves a bare backtick in the final string,
# which then runs as a command substitution at eval time and breaks the
# docker run invocation. Triple-backslash matches the existing emission
# convention used by docker-args-process-deploy.
for domain in $(echo "$app_domains" | xargs); do
if [[ -z "$result" ]]; then
result="Host(\\\`${domain}\\\`)"
result="Host(\`${domain}\`)"
continue
fi
result="${result} || Host(\\\`${domain}\\\`)"
result="${result} || Host(\`${domain}\`)"
done
echo "$result"
}