From 3902c467b91be39d6f9c468d3823d2d15927acd4 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu, 29 Sep 2022 15:34:11 +1000 Subject: [PATCH] Fixes `vite dev` by proxying socket.io --- frontend/vite.config.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 8cb39fe13a..643de3454a 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -7,12 +7,18 @@ export default defineConfig(({ mode }) => { const common = { plugins: [react(), eslint()], server: { + // Proxy HTTP requests to the flask server proxy: { '/outputs': { - target: 'http://localhost:9090/outputs', + target: 'http://127.0.0.1:9090/outputs', changeOrigin: true, rewrite: (path) => path.replace(/^\/outputs/, ''), }, + // Proxy socket.io to the flask-socketio server + '/socket.io': { + target: 'ws://127.0.0.1:9090', + ws: true, + }, }, }, build: {