浏览代码

HUE-8738 [task] Use https for websocket accordingly

Romain 5 年之前
父节点
当前提交
3dbf982a8f
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      desktop/libs/notebook/src/notebook/templates/editor_components2.mako

+ 2 - 1
desktop/libs/notebook/src/notebook/templates/editor_components2.mako

@@ -1578,7 +1578,8 @@
     });
 
     % if conf.WEBSOCKETS.ENABLED.get():
-      var editorWs = new WebSocket('ws://' + window.location.host + '/ws/editor/results/' + 'userA' + '/');
+      const prefix = location.protocol === 'https:' ? 'wss://' : 'ws://';
+      var editorWs = new WebSocket(prefix + window.location.host + '/ws/editor/results/' + 'userA' + '/');
 
       editorWs.onopen = function(e) {
         console.info('Notification socket open.');