attempt enforce https

This commit is contained in:
ian ramzy 2020-03-25 20:51:15 -04:00
parent 92f10af3ad
commit 4a2ba4fa51
3 changed files with 15 additions and 2 deletions

View File

@ -23,7 +23,7 @@
<a href="/landing" class="round-button">Back</a>
<a class="round-button" onclick="{openFullscreen()}">Fullscreen</a>
<a class="round-button" onclick="{muteMicrophone()}" id="muteButton">Mute </a>
<a class="round-button" onclick="{pauseVideo()}" id="videoPauseButton">Pause </a>
<!-- <a class="round-button" onclick="{pauseVideo()}" id="videoPauseButton">Pause </a>-->
</div>
</div>

View File

@ -133,7 +133,7 @@
"hot", "cold", "warm", "hungry", "slow", "fast", "red", "white", "black", "blue", "green"];
var nouns = ["dog", "bat", "wrench", "apple", "pear", "ghost", "cat", "wolf", "squid", "goat", "snail", "hat",
"sock", "plum", "bear", "snake", "turtle", "horse", "spoon", "fork", "spider", "tree", "chair", "table",
"couch", "towel"];
"couch", "towel", "panda", "bread", "grape","cake","brick", "rat", "mouse"];
var adjective = adjectives[Math.floor(Math.random() * adjectives.length)];
var noun = nouns[Math.floor(Math.random() * nouns.length)];
noun = noun.charAt(0).toUpperCase() + noun.substring(1);

View File

@ -8,6 +8,19 @@ var io = require('socket.io')(http);
var path = require('path');
var public = path.join(__dirname, 'public');
// Enforce HTTPS
app.use((req, res, next) => {
if (process.env.NODE_ENV === 'production') {
if (req.headers.host === 'neonchat.io')
return res.redirect(301, 'https://neonchat.io');
if (req.headers['x-forwarded-proto'] !== 'https')
return res.redirect('https://' + req.headers.host + req.url);
else
return next();
} else
return next();
});
app.use(express.static('public'));