server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Backend API dentro de la misma base HTTPS (evita mixed content). location /auth/ { proxy_pass http://backend:8074/auth/; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /exam/ { proxy_pass http://backend:8074/exam/; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location = /health { proxy_pass http://backend:8074/health; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } # SPA: cualquier ruta desconocida sirve index.html (React Router). location / { try_files $uri $uri/ /index.html; } # Cache de assets con hash. location /assets/ { expires 1y; add_header Cache-Control "public, immutable"; } gzip on; gzip_types text/css application/javascript application/json image/svg+xml; gzip_min_length 1024; }