diff --git a/src/Terminal.jsx b/src/Terminal.jsx index 418e9718..4c1052ae 100644 --- a/src/Terminal.jsx +++ b/src/Terminal.jsx @@ -70,10 +70,10 @@ export function NewTerminal({ hostConfig }) { // Create socket connection const isSecure = window.location.protocol === "https:"; - let ioUrl = `${isSecure ? "https" : "http"}://${window.location.hostname}:8081/socket.io/`; + let ioUrl = `${isSecure ? "https" : "http"}://${window.location.hostname}:${window.location.port}/socket.io/`; if (window.location.hostname === "localhost") { - ioUrl = "http://192.210.197.55:8000/socket.io/"; + ioUrl = "http://localhost:8081"; } const socket = io(ioUrl); diff --git a/vite.config.js b/vite.config.js index 8b0f57b9..189aba1e 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,7 +1,15 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; -// https://vite.dev/config/ export default defineConfig({ plugins: [react()], -}) + server: { + proxy: { + "/socket.io": { + target: "http://localhost:8081", + changeOrigin: true, + ws: true, // Enables WebSocket proxying + }, + }, + }, +}); \ No newline at end of file