export default defineConfig({
server: {
proxy: {
"/proxy": {
target: "http://121.10.140.87", // 线上服务器IP地址
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(/^\/proxy/, ""), // 路径转写
},
"/wsproxy": {
target: "ws://121.10.140.87", // 线上服务器websocket地址
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(/~\/wsproxy/, "") // 路径转写
}
},
},
})
标签:websocket,代理,ws,proxy,path,true,vite
From: https://www.cnblogs.com/isAyi/p/17731494.html