fix: Terminal WS ueber Nginx-Proxy statt direkt zum Backend (kein self-signed Cert Problem)

This commit is contained in:
cynfo3000 2026-03-07 00:30:59 +01:00
parent 257eee0c83
commit e44bd314e8

View File

@ -54,11 +54,11 @@ export default function TerminalModal({ agentId, agentName, onClose }) {
xtermRef.current = term xtermRef.current = term
fitRef.current = fitAddon fitRef.current = fitAddon
// WebSocket verbinden // WebSocket verbinden ueber Nginx-Proxy (gleicher Origin, kein Zertifikatsproblem)
const cols = term.cols || 220 const cols = term.cols || 220
const rows = term.rows || 50 const rows = term.rows || 50
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'wss:' const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
const wsUrl = `wss://${backendHost}:8443/api/v1/agents/${agentId}/terminal?cols=${cols}&rows=${rows}&api_key=${apiKey}` const wsUrl = `${wsProtocol}//${window.location.host}/api/v1/agents/${agentId}/terminal?cols=${cols}&rows=${rows}&api_key=${apiKey}`
const ws = new WebSocket(wsUrl) const ws = new WebSocket(wsUrl)
ws.binaryType = 'arraybuffer' ws.binaryType = 'arraybuffer'