diff --git a/compose.yml b/compose.yml
index 45d22c4..12f43ee 100644
--- a/compose.yml
+++ b/compose.yml
@@ -210,11 +210,30 @@ services:
if [ -n "$$GRAMPSWEB_SUBPATH" ] && [ "$$GRAMPSWEB_SUBPATH" != "/" ]; then
SUBPATH="$$GRAMPSWEB_SUBPATH"
case "$$SUBPATH" in */) ;; *) SUBPATH="$${SUBPATH}/" ;; esac
- echo "[grampsweb] Patching to $$SUBPATH ..."
+ echo "[grampsweb] Patching static files for subpath $$SUBPATH ..."
find / -name index.html -path "*/gramps*" -o -name index.html -path "*/static/*" 2>/dev/null | while read f; do
if grep -q '' "$$f" 2>/dev/null; then
sed -i "s|||g" "$$f"
- echo "[grampsweb] patched: $$f"
+ echo "[grampsweb] patched base href: $$f"
+ fi
+ done
+ for f in /app/static/*.js; do
+ if [ -f "$$f" ] && grep -q '/api/' "$$f" 2>/dev/null; then
+ sed -i "s|\"/api/|\"$${SUBPATH}api/|g" "$$f"
+ sed -i 's|`/api/|`'"$${SUBPATH}"'api/|g' "$$f"
+ sed -i "s|\"/lang/|\"$${SUBPATH}lang/|g" "$$f"
+ sed -i 's|`/lang/|`'"$${SUBPATH}"'lang/|g' "$$f"
+ sed -i "s|\"/fonts/|\"$${SUBPATH}fonts/|g" "$$f"
+ sed -i 's|`/fonts/|`'"$${SUBPATH}"'fonts/|g' "$$f"
+ sed -i "s|\"/assets/|\"$${SUBPATH}assets/|g" "$$f"
+ sed -i 's|`/assets/|`'"$${SUBPATH}"'assets/|g' "$$f"
+ echo "[grampsweb] patched JS paths: $$f"
+ fi
+ done
+ for f in /app/static/*.css; do
+ if [ -f "$$f" ] && grep -q '"/fonts/' "$$f" 2>/dev/null; then
+ sed -i "s|\"/fonts/|\"$${SUBPATH}fonts/|g" "$$f"
+ echo "[grampsweb] patched CSS paths: $$f"
fi
done
echo "[grampsweb] Done."
diff --git a/deploy-production/docker-compose.prod.yml b/deploy-production/docker-compose.prod.yml
index fe4b69a..8eb9688 100644
--- a/deploy-production/docker-compose.prod.yml
+++ b/deploy-production/docker-compose.prod.yml
@@ -136,11 +136,30 @@ services:
if [ -n "$$GRAMPSWEB_SUBPATH" ] && [ "$$GRAMPSWEB_SUBPATH" != "/" ]; then
SUBPATH="$$GRAMPSWEB_SUBPATH"
case "$$SUBPATH" in */) ;; *) SUBPATH="$${SUBPATH}/" ;; esac
- echo "[grampsweb] Patching to $$SUBPATH ..."
+ echo "[grampsweb] Patching static files for subpath $$SUBPATH ..."
find / -name index.html -path "*/gramps*" -o -name index.html -path "*/static/*" 2>/dev/null | while read f; do
if grep -q '' "$$f" 2>/dev/null; then
sed -i "s|||g" "$$f"
- echo "[grampsweb] patched: $$f"
+ echo "[grampsweb] patched base href: $$f"
+ fi
+ done
+ for f in /app/static/*.js; do
+ if [ -f "$$f" ] && grep -q '/api/' "$$f" 2>/dev/null; then
+ sed -i "s|\"/api/|\"$${SUBPATH}api/|g" "$$f"
+ sed -i 's|`/api/|`'"$${SUBPATH}"'api/|g' "$$f"
+ sed -i "s|\"/lang/|\"$${SUBPATH}lang/|g" "$$f"
+ sed -i 's|`/lang/|`'"$${SUBPATH}"'lang/|g' "$$f"
+ sed -i "s|\"/fonts/|\"$${SUBPATH}fonts/|g" "$$f"
+ sed -i 's|`/fonts/|`'"$${SUBPATH}"'fonts/|g' "$$f"
+ sed -i "s|\"/assets/|\"$${SUBPATH}assets/|g" "$$f"
+ sed -i 's|`/assets/|`'"$${SUBPATH}"'assets/|g' "$$f"
+ echo "[grampsweb] patched JS paths: $$f"
+ fi
+ done
+ for f in /app/static/*.css; do
+ if [ -f "$$f" ] && grep -q '"/fonts/' "$$f" 2>/dev/null; then
+ sed -i "s|\"/fonts/|\"$${SUBPATH}fonts/|g" "$$f"
+ echo "[grampsweb] patched CSS paths: $$f"
fi
done
echo "[grampsweb] Done."