Try a unified api endpoint
This commit is contained in:
@@ -74,11 +74,19 @@ function buildAllowedHosts(env: Record<string, string>): string[] | undefined {
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '');
|
||||
const allowedHosts = buildAllowedHosts(env);
|
||||
const apiProxyTarget = env.VITE_API_PROXY_TARGET?.trim() || 'http://localhost:8000';
|
||||
|
||||
return {
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: 5173,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: apiProxyTarget,
|
||||
changeOrigin: false,
|
||||
secure: false,
|
||||
},
|
||||
},
|
||||
...(allowedHosts ? { allowedHosts } : {}),
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user