Fix GrampsWeb subpath: use nginx sub_filter for <base href> rewrite (STI-93)
GrampsWeb's SPA has <base href="/"> hardcoded at build time. The GRAMPSWEB_BASE_URL env var is a full URL for API/OIDC, not a path prefix. This means assets always load from root, hitting Django instead of GrampsWeb. Fix: nginx sub_filter rewrites <base href="/"> to <base href="/ahnenforschung/"> so the browser resolves all SPA assets under the correct subpath. Also revert BASE_URL default to a proper URL (not a path). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -83,6 +83,8 @@ server {
|
||||
}
|
||||
|
||||
# GrampsWeb Ahnenforschung
|
||||
# GrampsWeb SPA has <base href="/"> hardcoded — sub_filter rewrites it
|
||||
# so asset URLs resolve under /ahnenforschung/ instead of /
|
||||
location /ahnenforschung/ {
|
||||
proxy_pass http://127.0.0.1:8090/;
|
||||
proxy_set_header Host $host;
|
||||
@@ -91,7 +93,14 @@ server {
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Script-Name /ahnenforschung;
|
||||
|
||||
# WebSocket support (GrampsWeb uses SSE/WS for real-time updates)
|
||||
# Rewrite <base href="/"> to <base href="/ahnenforschung/">
|
||||
# so the SPA loads JS/CSS from the correct subpath
|
||||
proxy_set_header Accept-Encoding "";
|
||||
sub_filter '<base href="/">' '<base href="/ahnenforschung/">';
|
||||
sub_filter_once on;
|
||||
sub_filter_types text/html;
|
||||
|
||||
# WebSocket support
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
Reference in New Issue
Block a user