Fix nginx: add location block for double fonts/ path in GrampsWeb (STI-91)
GrampsWeb's fonts.css references url('fonts/file.woff2') but is served
from /ahnenforschung/fonts/fonts.css, causing the browser to request
/ahnenforschung/fonts/fonts/file.woff2 (double fonts/ directory).
Instead of relying on sub_filter to rewrite CSS content, add a dedicated
location block that proxies /ahnenforschung/fonts/fonts/ to the correct
/fonts/ path on the GrampsWeb container. This is more robust as it works
regardless of CSS content-type matching.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -82,6 +82,17 @@ server {
|
||||
proxy_send_timeout 300s;
|
||||
}
|
||||
|
||||
# GrampsWeb: fix double fonts/ path from CSS relative URL resolution
|
||||
# fonts.css at /ahnenforschung/fonts/ references url('fonts/file.woff2')
|
||||
# which resolves to /ahnenforschung/fonts/fonts/file.woff2
|
||||
location /ahnenforschung/fonts/fonts/ {
|
||||
proxy_pass http://127.0.0.1:8090/fonts/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# GrampsWeb Ahnenforschung
|
||||
# All path rewriting happens here via sub_filter — no container-side patching needed.
|
||||
# GrampsWeb SPA uses Vaadin Router with absolute paths; the injected History API
|
||||
@@ -126,11 +137,7 @@ server {
|
||||
# JS: service worker route handling
|
||||
sub_filter 'createHandlerBoundToURL("/index.html")' 'createHandlerBoundToURL("/ahnenforschung/index.html")';
|
||||
|
||||
# CSS: fix font paths in fonts.css — the CSS lives at /ahnenforschung/fonts/fonts.css
|
||||
# and references url('fonts/MaterialIcons.woff2') which resolves to
|
||||
# /ahnenforschung/fonts/fonts/MaterialIcons.woff2 (double fonts/).
|
||||
# Strip the fonts/ prefix so url('MaterialIcons.woff2') resolves correctly.
|
||||
sub_filter "url('fonts/" "url('";
|
||||
# CSS font paths: handled by separate location block for /ahnenforschung/fonts/fonts/
|
||||
|
||||
# WebSocket support
|
||||
proxy_http_version 1.1;
|
||||
|
||||
Reference in New Issue
Block a user