Changes to connection system to support docker

This commit is contained in:
Karmaa
2025-03-12 20:07:39 -05:00
parent 615c8d4ceb
commit 994de92451
3 changed files with 8 additions and 9 deletions

View File

@@ -24,16 +24,16 @@ http {
proxy_pass http://127.0.0.1:8081;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade"; # Fix this line to properly upgrade WebSockets
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
# Pass real IPs for logging and security
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Proxy MongoDB socket requests
location /database.io/ {
proxy_pass http://127.0.0.1:8082;
proxy_http_version 1.1;
@@ -42,7 +42,6 @@ http {
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
# Allow WebSockets to function properly
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

View File

@@ -63,10 +63,10 @@ export const NewTerminal = forwardRef(({ hostConfig, isVisible }, ref) => {
const socket = io(
window.location.hostname === "localhost"
? "http://localhost:8081/ssh.io"
: "/ssh.io",
? "http://localhost:8081" // Modified path here
: "/",
{
path: "/ssh.io/socket.io",
path: "/ssh.io/socket.io", // Same path, no need to modify
transports: ["websocket", "polling"],
}
);
@@ -177,4 +177,4 @@ NewTerminal.propTypes = {
port: PropTypes.string.isRequired,
}).isRequired,
isVisible: PropTypes.bool.isRequired,
};
};

View File

@@ -4,9 +4,9 @@ const SSHClient = require("ssh2").Client;
const server = http.createServer();
const io = socketIo(server, {
path: "/ssh.io/socket.io",
path: "/ssh.io/socket.io", // Corrected path for socket.io
cors: {
origin: "*",
origin: "*", // Temporarily set to '*' to allow all origins. Change to specific URLs if needed.
methods: ["GET", "POST"],
credentials: true
},