28 lines
703 B
TypeScript
28 lines
703 B
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import type { IncomingMessage } from 'http'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
server: {
|
|
host: '0.0.0.0',
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8073',
|
|
changeOrigin: true,
|
|
router: (req: IncomingMessage) => {
|
|
const host = req.headers.host?.split(':')[0] || 'localhost';
|
|
return `http://${host}:8073`;
|
|
},
|
|
} as any,
|
|
'/broker': {
|
|
target: 'ws://10.42.23.73:8083',
|
|
ws: true,
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/broker/, ''),
|
|
},
|
|
},
|
|
},
|
|
})
|