use wss if useSecureWebsockets is true

There are no certs / httpOtps set if proxy doing ssl offloading.
Better use useSecureWebsockets from config file.
pull/1/head
felixboehm 8 years ago committed by GitHub
parent d8c18d0937
commit 7c0df5aed9

@ -11,6 +11,7 @@ var WebRTCSrv = require('./WebRTCSrv');
var config = require('./config'); var config = require('./config');
var websocketPort = config.websocketPort || config.httpPort; var websocketPort = config.websocketPort || config.httpPort;
var useSecureWebsockets = config.useSecureWebsockets || false;
// support multiple storage back ends // support multiple storage back ends
var Storage = require(config.storage||'./storage/file'); 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.setHeader('Content-Type', 'text/javascript');
res.send('define(' + JSON.stringify({ res.send('define(' + JSON.stringify({
websocketPath: config.websocketPath, websocketPath: config.websocketPath,
websocketURL:'ws' + ((httpsOpts) ? 's' : '') + '://' + host + ':' + websocketURL:'ws' + ((useSecureWebsockets) ? 's' : '') + '://' + host + ':' +
websocketPort + '/cryptpad_websocket', websocketPort + '/cryptpad_websocket',
}) + ');'); }) + ');');
}); });

Loading…
Cancel
Save