Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefix websocket path with server path #1058

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion app/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,20 @@ var UI = {
}
}

var path = 'websockify';
// If noVNC is not being served at the root path, prefix
// the default websocket path with the server path.
var pathName = window.location.pathname.slice(1);
if (pathName.length != 0) { // We are not at the root path
if (pathName.slice(-1) == '/') {
// There's a trailing slash.
path = pathName + 'websockify';
} else {
// There's no trailing slash.
path = pathName + '/websockify';
}
}

/* Populate the controls if defaults are provided in the URL */
UI.initSetting('host', window.location.hostname);
UI.initSetting('port', port);
Expand All @@ -164,7 +178,7 @@ var UI = {
UI.initSetting('resize', 'off');
UI.initSetting('shared', true);
UI.initSetting('view_only', false);
UI.initSetting('path', 'websockify');
UI.initSetting('path', path);
UI.initSetting('repeaterID', '');
UI.initSetting('reconnect', false);
UI.initSetting('reconnect_delay', 5000);
Expand Down