fix(ui): serve assets under ui prefix

This commit is contained in:
tkmk 2026-07-09 07:24:18 +08:00
parent bd23c44cb1
commit a24d6d5c91

View file

@ -76,9 +76,16 @@ http {
# /ui[/<page>] — the dashboard's JS hardcodes URLs under this prefix
# (router.replace("/ui"), buildLoginUrlWithReturn("/ui/login"), ...).
# Mirror what FastAPI StaticFiles(mount="/ui") did in the monolithic
# proxy_server: serve /ui/<page> from out/<page>.html, with App
# Router-aware fallback (out/<page>/index.html) and a final SPA
# fallback to out/index.html for client-side routes.
# proxy_server: serve /ui/assets/... from out/assets/... and serve
# /ui/<page> from out/<page>.html, with App Router-aware fallback
# (out/<page>/index.html) and a final SPA fallback to out/index.html
# for client-side routes.
location ^~ /ui/assets/ {
alias /usr/share/nginx/html/assets/;
try_files $uri =404;
expires 1y;
add_header Cache-Control "public, immutable";
}
location = /ui { try_files /index.html =404; }
location = /ui/ { try_files /index.html =404; }
location ~ ^/ui/(.+)$ {