Use href to create the websockify URL

This commit is contained in:
Albrecht Lohofener
2025-03-28 07:24:12 +01:00
parent 6245dbd1c4
commit e07c2c6530
@@ -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');