fix is with transport

This commit is contained in:
Dobromir Popov
2024-02-23 20:16:15 +02:00
parent d51f6bfbba
commit e7d127f1ed
3 changed files with 11 additions and 4 deletions

View File

@ -6,6 +6,7 @@ const fs = require("fs");
const dotenv = require("dotenv");
const data = require("./src/helpers/data");
const sharp = require('sharp');
const https = require('https');
//const getPort = require("get-port");
if (process.env.NODE_ENV === 'test') {
@ -55,16 +56,17 @@ const prisma = common.getPrismaClient();
app
.prepare()
.then(() => {
const server = express();
//check if ssl is enabled
if (process.env.SSL_ENABLED === "true") {
const options = {
key: fs.readFileSync(process.env.SSL_KEY),
cert: fs.readFileSync(process.env.SSL_CERT),
};
https.createServer(options, server).listen(443);
https.createServer(options, server).listen(PORT);
}
const server = express();
// Add the middleware to set 'x-forwarded-host' header
server.use((req, res, next) => {
req.headers['x-forwarded-host'] = req.headers['x-forwarded-host'] || req.headers.host;
@ -542,7 +544,7 @@ app
});
})
.catch((ex) => {
console.warn("Error starting server on ${NEXT_PUBLIC_HOST}:${PORT}")
console.warn(`Error starting server on ${HOST}:${PORT}`)
console.error(ex.stack);
process.exit(1);
});