env/ debug

This commit is contained in:
Dobromir Popov
2024-02-27 03:15:59 +02:00
parent a5a24512a8
commit b6abb81195
3 changed files with 17 additions and 7 deletions

View File

@ -73,12 +73,12 @@ app
if (process.env.SSL_ENABLED === "true") {
console.log("SSL_ENABLED = true");
// Redirect from http to https
server.use((req, res, next) => {
if (req.headers['x-forwarded-proto'] !== 'https') {
return res.redirect(`https://${req.headers.host}${req.url}`);
}
next();
});
// server.use((req, res, next) => {
// if (req.headers['x-forwarded-proto'] !== 'https') {
// return res.redirect(`https://${req.headers.host}${req.url}`);
// }
// next();
// });
if (process.env.SSL_KEY && process.env.SSL_CERT) {
const options = {
key: fs.readFileSync(process.env.SSL_KEY),