From c38c476df80769b0586b9b1f745dd2db1bb6edcf Mon Sep 17 00:00:00 2001 From: Ashish Dahiya Date: Fri, 30 Sep 2016 19:26:48 -0700 Subject: [PATCH] Create ws_url from wsUrl attribute. If wsUrl is not found, fallback to location.host --- notebook/static/terminal/js/main.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/notebook/static/terminal/js/main.js b/notebook/static/terminal/js/main.js index e976ca754..035a6b528 100644 --- a/notebook/static/terminal/js/main.js +++ b/notebook/static/terminal/js/main.js @@ -38,8 +38,12 @@ require([ var base_url = utils.get_body_data('baseUrl'); var ws_path = utils.get_body_data('wsPath'); - var ws_url = location.protocol.replace('http', 'ws') + "//" + location.host - + base_url + ws_path; + var ws_url = utils.get_body_data('wsUrl'); + if (!ws_url) { + // trailing 's' in https will become wss for secure web sockets + ws_url = location.protocol.replace('http', 'ws') + "//" + location.host; + } + ws_url = ws_url + base_url + ws_path; var header = $("#header")[0];