fix: Configure Vite for nginx reverse proxy
Some checks failed
DSS Project Analysis / dss-context-update (push) Has been cancelled
Some checks failed
DSS Project Analysis / dss-context-update (push) Has been cancelled
- Add --host flag to bind to all interfaces - Add __VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS env var for external domain - Configure allowedHosts in vite.config.ts - Remove duplicate vite.config.js (was overriding .ts config) - Enable IPv4 binding for nginx proxy compatibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS=dss.overbits.luz.uy vite --host",
|
||||||
"build": "tsc && vite build",
|
"build": "tsc && vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"test": "vitest",
|
"test": "vitest",
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
import { defineConfig } from 'vite'
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
plugins: [],
|
|
||||||
|
|
||||||
server: {
|
|
||||||
port: 3456,
|
|
||||||
open: false,
|
|
||||||
strictPort: true,
|
|
||||||
cors: true,
|
|
||||||
// Proxy configuration for backend API integration
|
|
||||||
proxy: {
|
|
||||||
'/api': {
|
|
||||||
target: 'http://localhost:8002',
|
|
||||||
changeOrigin: true,
|
|
||||||
secure: false, // Allow proxying to HTTP backend from HTTPS frontend
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Hot Module Replacement configuration
|
|
||||||
hmr: {
|
|
||||||
protocol: 'http',
|
|
||||||
host: 'localhost',
|
|
||||||
port: 3456
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
build: {
|
|
||||||
outDir: 'dist',
|
|
||||||
sourcemap: false,
|
|
||||||
minify: 'terser',
|
|
||||||
// Treat paths with /admin-ui/ prefix as external (from index.html inline scripts)
|
|
||||||
rollupOptions: {
|
|
||||||
external: (id) => {
|
|
||||||
// External paths starting with /admin-ui/
|
|
||||||
if (id.startsWith('/admin-ui/')) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
manualChunks: (id) => {
|
|
||||||
if (id.includes('/js/core/')) return 'core'
|
|
||||||
if (id.includes('/js/services/')) return 'services'
|
|
||||||
if (id.includes('/js/components/')) return 'components'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
preview: {
|
|
||||||
port: 3456,
|
|
||||||
open: false
|
|
||||||
},
|
|
||||||
|
|
||||||
resolve: {
|
|
||||||
alias: {
|
|
||||||
'@': '/js'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
@@ -56,7 +56,9 @@ export default defineConfig(({ mode }) => ({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
|
host: '0.0.0.0', // Bind to all interfaces for nginx proxy compatibility
|
||||||
port: 3456,
|
port: 3456,
|
||||||
|
allowedHosts: ['dss.overbits.luz.uy', 'localhost', '.localhost'], // Allow external domain and localhost
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://localhost:8002',
|
target: 'http://localhost:8002',
|
||||||
|
|||||||
Reference in New Issue
Block a user