Skip to content

Commit 884eb8c

Browse files
authored
Merge pull request #1802 from ashishdahiya/ws_url
Set ws-url data attribute when accessing a notebook terminal
2 parents 38f57ef + c38c476 commit 884eb8c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

notebook/static/terminal/js/main.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@ require([
3838

3939
var base_url = utils.get_body_data('baseUrl');
4040
var ws_path = utils.get_body_data('wsPath');
41-
var ws_url = location.protocol.replace('http', 'ws') + "//" + location.host
42-
+ base_url + ws_path;
41+
var ws_url = utils.get_body_data('wsUrl');
42+
if (!ws_url) {
43+
// trailing 's' in https will become wss for secure web sockets
44+
ws_url = location.protocol.replace('http', 'ws') + "//" + location.host;
45+
}
46+
ws_url = ws_url + base_url + ws_path;
4347

4448
var header = $("#header")[0];
4549

notebook/templates/terminal.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
{% block params %}
88

99
data-base-url="{{base_url | urlencode}}"
10+
data-ws-url="{{ws_url | urlencode}}"
1011
data-ws-path="{{ws_path}}"
1112

1213
{% endblock %}

0 commit comments

Comments
 (0)