From 214e92f4a942d942969a3c7d840e278ea32d216d Mon Sep 17 00:00:00 2001 From: Tommy Tang Date: Thu, 31 Aug 2017 09:49:16 +0000 Subject: [PATCH] add relpath for websocker uri --- Dockerfile | 2 +- core/rfb.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 62d749ec..1b155532 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM python -ENV VER=${VER:-relpath} \ +ENV VER=${VER:-master} \ REPO=https://github.com/twhtanghk/noVNC \ APP=/usr/src/app diff --git a/core/rfb.js b/core/rfb.js index ece0f008..5aa5a1db 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -392,7 +392,10 @@ RFB.prototype = { uri = this._encrypt ? 'wss' : 'ws'; } - uri += '://' + this._rfb_host + ':' + this._rfb_port + '/' + this._rfb_path; + var relpath = location.pathname.split('/'); + relpath.splice(1, -1); + relpath = relpath.join('/') + '/'; + uri += '://' + this._rfb_host + ':' + this._rfb_port + relpath + this._rfb_path; Log.Info("connecting to " + uri); try {