From 7c0df5aed9ad8b92bd5d093e9194681cfa7f6b21 Mon Sep 17 00:00:00 2001 From: felixboehm Date: Mon, 2 Jan 2017 11:54:50 +0100 Subject: [PATCH] use wss if useSecureWebsockets is true There are no certs / httpOtps set if proxy doing ssl offloading. Better use useSecureWebsockets from config file. --- server.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index f24117bd1..31d536de8 100644 --- a/server.js +++ b/server.js @@ -11,6 +11,7 @@ var WebRTCSrv = require('./WebRTCSrv'); var config = require('./config'); var websocketPort = config.websocketPort || config.httpPort; +var useSecureWebsockets = config.useSecureWebsockets || false; // support multiple storage back ends var Storage = require(config.storage||'./storage/file'); @@ -80,7 +81,7 @@ app.get('/api/config', function(req, res){ res.setHeader('Content-Type', 'text/javascript'); res.send('define(' + JSON.stringify({ websocketPath: config.websocketPath, - websocketURL:'ws' + ((httpsOpts) ? 's' : '') + '://' + host + ':' + + websocketURL:'ws' + ((useSecureWebsockets) ? 's' : '') + '://' + host + ':' + websocketPort + '/cryptpad_websocket', }) + ');'); });