This commit is contained in:
Mackie 2026-06-08 07:54:36 +08:00
parent e8b25b21ef
commit ada0be589f
2 changed files with 12 additions and 13 deletions

View file

@ -1,19 +1,21 @@
server { server {
listen 80; listen 80;
root /usr/share/nginx/html;
index index.html; # 1. Handle the path Traefik is routing
# This location must match the Traefik PathPrefix
location /lab/data-dashboard/ { location /lab/data-dashboard/ {
alias /usr/share/nginx/html/; alias /usr/share/nginx/html/;
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
} }
# Keep a root location for the Health Check # 2. Add an explicit health check endpoint (returns 200 OK)
location / { location /health {
try_files $uri $uri/ /index.html; return 200 'healthy';
add_header Content-Type text/plain;
} }
gzip on; # 3. Fallback for SPA routing
gzip_types text/css application/javascript application/json; location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
} }

View file

@ -2,9 +2,6 @@ import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
export default defineConfig({ export default defineConfig({
base: '/lab/data-dashboard/', // Essential: This fixes the asset 404s base: '/lab/data-dashboard/',
plugins: [react()], plugins: [react()],
worker: {
format: 'es',
},
}); });