diff --git a/server.js b/server.js index 26b7633..81462a1 100755 --- a/server.js +++ b/server.js @@ -89,18 +89,20 @@ function exit (reason) { const app = express() -app.use(function (req, res, next) { - if (req.secure) { - next() - } else { - logger.DebugLog(`HTTPS ${req.method} redirect to: ${'https://' + req.headers.host + req.url}`, 'https', 1) - if (req.method === 'POST') { - res.redirect(307, 'https://' + req.headers.host + req.url) +if (!process.env.NS_DEVEL) { + app.use(function (req, res, next) { + if (req.secure) { + next() } else { - res.redirect('https://' + req.headers.host + req.url) + logger.DebugLog(`HTTPS ${req.method} redirect to: ${'https://' + req.headers.host + req.url}`, 'https', 1) + if (req.method === 'POST') { + res.redirect(307, 'https://' + req.headers.host + req.url) + } else { + res.redirect('https://' + req.headers.host + req.url) + } } - } -}) + }) +} // https://github.com/expressjs/cors#configuration-options app.use(cors({ credentials: true,