Add httpOnly mode
parent
0bd983b10a
commit
c8dd705530
|
|
@ -47,6 +47,10 @@ module.exports =
|
|||
// Any http request is redirected to https.
|
||||
// Listening port for http server.
|
||||
listeningRedirectPort : 80,
|
||||
// Listens only on http, only on listeningPort
|
||||
// listeningRedirectPort disabled
|
||||
// use case: loadbalancer backend
|
||||
httpOnly: true,
|
||||
// If this is set to true, only signed-in users will be able
|
||||
// to join a room directly. Non-signed-in users (guests) will
|
||||
// always be put in the lobby regardless of room lock status.
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ passport.deserializeUser((user, done) =>
|
|||
done(null, user);
|
||||
});
|
||||
|
||||
let httpsServer;
|
||||
let mainListener;
|
||||
let io;
|
||||
let oidcClient;
|
||||
let oidcStrategy;
|
||||
|
|
@ -427,13 +427,22 @@ async function runHttpsServer()
|
|||
|
||||
app.use((req, res) => res.sendFile(`${__dirname}/public/index.html`));
|
||||
|
||||
httpsServer = spdy.createServer(tls, app);
|
||||
if (config.httpOnly === true)
|
||||
{
|
||||
// http
|
||||
mainListener = http.createServer(app);
|
||||
} else {
|
||||
// https
|
||||
mainListener = spdy.createServer(tls, app);
|
||||
|
||||
httpsServer.listen(config.listeningPort);
|
||||
// http
|
||||
const redirectListener = http.createServer(app);
|
||||
redirectListener.listen(config.listeningRedirectPort);
|
||||
}
|
||||
|
||||
const httpServer = http.createServer(app);
|
||||
// https or http
|
||||
mainListener.listen(config.listeningPort);
|
||||
|
||||
httpServer.listen(config.listeningRedirectPort);
|
||||
}
|
||||
|
||||
function isPathAlreadyTaken(url)
|
||||
|
|
@ -462,7 +471,7 @@ function isPathAlreadyTaken(url)
|
|||
*/
|
||||
async function runWebSocketServer()
|
||||
{
|
||||
io = require('socket.io')(httpsServer);
|
||||
io = require('socket.io')(mainListener);
|
||||
|
||||
io.use(
|
||||
sharedSession(session, {
|
||||
|
|
|
|||
Loading…
Reference in New Issue