main
sp mac bookpro 2605 2026-05-24 19:52:11 +08:00
parent a77affbd0e
commit 3bae006887
1 changed files with 2 additions and 1 deletions

View File

@ -4,7 +4,7 @@ import react from '@vitejs/plugin-react';
// 默认走 Go 后端 :4001要回退 Node 后端就 set VITE_API_TARGET=http://localhost:4000 // 默认走 Go 后端 :4001要回退 Node 后端就 set VITE_API_TARGET=http://localhost:4000
export default defineConfig(({ mode }) => { export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), ''); const env = loadEnv(mode, process.cwd(), '');
const target = env.VITE_API_TARGET || 'http://localhost:4001'; const target = env.VITE_API_TARGET || 'https://api.redhare.cc';
return { return {
plugins: [react()], plugins: [react()],
server: { server: {
@ -13,6 +13,7 @@ export default defineConfig(({ mode }) => {
'/api': { '/api': {
target, target,
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '/aura/v1'),
// SSE 不要被压缩;保持长连接 // SSE 不要被压缩;保持长连接
configure: (proxy) => { configure: (proxy) => {
proxy.on('proxyReq', (proxyReq) => { proxy.on('proxyReq', (proxyReq) => {