diff --git a/docker/nginx.conf b/docker/nginx.conf index 0514db1b..65c1ae2a 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -19,8 +19,8 @@ http { index index.html index.htm; } - # Proxy WebSocket requests - location /io/ { + # Proxy IO requests + location /socket.io/ { proxy_pass http://localhost:8081; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; diff --git a/src/Terminal.jsx b/src/Terminal.jsx index 2dd7c2df..525c6237 100644 --- a/src/Terminal.jsx +++ b/src/Terminal.jsx @@ -70,7 +70,11 @@ export function NewTerminal({ hostConfig }) { // Create socket connection const isSecure = window.location.protocol === "https:"; const wsProtocol = isSecure ? "https" : "http"; - const ioUrl = `${wsProtocol}://${window.location.host}/io/`; + let ioUrl = `${wsProtocol}://${window.location.host}/socket.io/`; + + if(window.location.hostname === "localhost") { + ioUrl = "http://localhost:8081"; + } const socket = io(ioUrl); diff --git a/src/backend/server.cjs b/src/backend/server.cjs index 7ed3ca5b..6d24b766 100644 --- a/src/backend/server.cjs +++ b/src/backend/server.cjs @@ -14,8 +14,6 @@ io.on("connection", (socket) => { console.log("New socket connection established"); let stream = null; - let currentCols = 80; - let currentRows = 24; socket.on("connectToHost", (cols, rows, hostConfig) => { if (!hostConfig || !hostConfig.ip || !hostConfig.user || !hostConfig.password || !hostConfig.port) {