https redirect

This commit is contained in:
gocivici 2023-09-27 13:56:42 +03:00
parent d016dd97eb
commit 63ac316959
3 changed files with 10 additions and 1 deletions

View File

@ -11,6 +11,15 @@ const io = new Server(server, {
pingTimeout:5000
})
app.use(requireHTTPS);
function requireHTTPS(req, res, next) {
// The 'x-forwarded-proto' check is for Heroku
if (!req.secure && req.get('x-forwarded-proto') !== 'https' && process.env.NODE_ENV !== "development") {
return res.redirect('https://' + req.get('host') + req.url);
}
next();
}
// const port = 3000
app.use(express.static('public'))

BIN
public/ghost2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -16,7 +16,7 @@ let row = 0;
let readyNow = false
let animationFrame = 0;
let pageVisible = true;
let debugMode = true;
let debugMode = false;
let timeoutHandle;
// let atPosition = true;