feat: support cross-origin deployment with VITE_API_BASE_URL

- Set VITE_API_BASE_URL=https://opinion-api.moreminimore.com for
  frontend-backend split deployment
- Vite proxy also uses API_BACKEND_URL env var as target
- Falls back to same-origin proxy for local dev
This commit is contained in:
Kunthawat Greethong
2026-06-17 12:11:22 +07:00
parent aadc11ad83
commit 9f2232d40b
3 changed files with 15 additions and 2 deletions

View File

@@ -18,9 +18,9 @@ export default defineConfig({
allowedHosts: true,
proxy: {
'/api': {
target: 'http://localhost:5001',
target: process.env.API_BACKEND_URL || 'http://localhost:5001',
changeOrigin: true,
secure: false
secure: true
}
}
}