diff --git a/nginx.conf b/nginx.conf index ba1a6fa..cd9dfd7 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,19 +1,21 @@ server { listen 80; - root /usr/share/nginx/html; - index index.html; - - # This location must match the Traefik PathPrefix + + # 1. Handle the path Traefik is routing location /lab/data-dashboard/ { alias /usr/share/nginx/html/; try_files $uri $uri/ /index.html; } - # Keep a root location for the Health Check - location / { - try_files $uri $uri/ /index.html; + # 2. Add an explicit health check endpoint (returns 200 OK) + location /health { + return 200 'healthy'; + add_header Content-Type text/plain; } - gzip on; - gzip_types text/css application/javascript application/json; + # 3. Fallback for SPA routing + location / { + root /usr/share/nginx/html; + try_files $uri $uri/ /index.html; + } } \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index ec14640..acccb8c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,9 +2,6 @@ import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; export default defineConfig({ - base: '/lab/data-dashboard/', // Essential: This fixes the asset 404s + base: '/lab/data-dashboard/', plugins: [react()], - worker: { - format: 'es', - }, }); \ No newline at end of file