The server-ui's entrypoint inserts <base href> THEN rewrites all href="/" — including the just-inserted base tag, causing doubling. Patched entrypoint rewrites asset paths first, then inserts <base>. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
21 lines
741 B
Bash
21 lines
741 B
Bash
#!/bin/sh
|
|
# Patched entrypoint: fixes the sed ordering bug in the server-ui image.
|
|
# The original entrypoint inserts <base href> then rewrites ALL href="/..."
|
|
# including the just-inserted base tag, causing /server/server/ doubling.
|
|
|
|
BASE_PATH="${BASE_PATH:-/}"
|
|
|
|
if [ "$BASE_PATH" != "/" ]; then
|
|
BASE_PATH=$(echo "$BASE_PATH" | sed 's#/*$#/#; s#^/*#/#')
|
|
|
|
INDEX="/usr/share/nginx/html/index.html"
|
|
# Rewrite absolute asset paths FIRST (before inserting <base>)
|
|
sed -i "s|href=\"/|href=\"${BASE_PATH}|g; s|src=\"/|src=\"${BASE_PATH}|g" "$INDEX"
|
|
# THEN inject <base> tag
|
|
sed -i "s|<head>|<head><base href=\"${BASE_PATH}\">|" "$INDEX"
|
|
|
|
echo "BASE_PATH set to ${BASE_PATH} — rewrote index.html"
|
|
fi
|
|
|
|
exec /docker-entrypoint.sh "$@"
|