From 98a45e91613d03add458f4678bbab6c264f83171 Mon Sep 17 00:00:00 2001 From: Karmaa Date: Sun, 9 Feb 2025 02:23:31 -0600 Subject: [PATCH] Updated dockerfile for new file structure --- docker/nginx.conf | 4 ++-- src/Terminal.jsx | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docker/nginx.conf b/docker/nginx.conf index edbe63ae..0514db1b 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -20,8 +20,8 @@ http { } # Proxy WebSocket requests - location /ws/ { - proxy_pass http://localhost:8081; # Backend WebSocket server + location /io/ { + proxy_pass http://localhost:8081; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; diff --git a/src/Terminal.jsx b/src/Terminal.jsx index 2befc9c5..2dd7c2df 100644 --- a/src/Terminal.jsx +++ b/src/Terminal.jsx @@ -68,10 +68,11 @@ export function NewTerminal({ hostConfig }) { terminal.write("\r\n*** Connecting to backend ***\r\n"); // Create socket connection - const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; - const wsUrl = `${protocol}//${window.location.host}/ws/`; + const isSecure = window.location.protocol === "https:"; + const wsProtocol = isSecure ? "https" : "http"; + const ioUrl = `${wsProtocol}://${window.location.host}/io/`; - const socket = io(wsUrl); + const socket = io(ioUrl); // Emit hostConfig to start SSH connection socket.on("connect", () => {