chore(vite): proxy /api to https://api.redhare.cc/aura/v1
parent
a77affbd0e
commit
3bae006887
|
|
@ -4,7 +4,7 @@ import react from '@vitejs/plugin-react';
|
|||
// 默认走 Go 后端 :4001;要回退 Node 后端就 set VITE_API_TARGET=http://localhost:4000
|
||||
export default defineConfig(({ mode }) => {
|
||||
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 {
|
||||
plugins: [react()],
|
||||
server: {
|
||||
|
|
@ -13,6 +13,7 @@ export default defineConfig(({ mode }) => {
|
|||
'/api': {
|
||||
target,
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '/aura/v1'),
|
||||
// SSE 不要被压缩;保持长连接
|
||||
configure: (proxy) => {
|
||||
proxy.on('proxyReq', (proxyReq) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue