From e07c2c6530672bd37cf40d648aba2489181a38d9 Mon Sep 17 00:00:00 2001 From: Albrecht Lohofener Date: Fri, 28 Mar 2025 07:24:12 +0100 Subject: [PATCH] Use href to create the websockify URL --- web-frontend/src/app/console/console.component.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web-frontend/src/app/console/console.component.ts b/web-frontend/src/app/console/console.component.ts index 40f3bda..71c45c6 100644 --- a/web-frontend/src/app/console/console.component.ts +++ b/web-frontend/src/app/console/console.component.ts @@ -45,8 +45,14 @@ export class ConsoleComponent implements AfterViewInit { } startClient() { - //let url = "ws://localhost:8006/websockify" // Just for development - let url = window.location.origin + '/websockify'; + // TODO: Not ideal because it depends that the URL contains "console". + // But I didn't find a way how to detect if the frontend runs behind a reverse proxy. + let href = window.location.href; + let url = href.replace(/console/gi, "websockify"); + + // Just for development + //let url = "ws://localhost:8006/websockify" + console.log("URL: ", url); const container: HTMLElement | null = document.getElementById('vnc-screen');