fix(all): Minor changes in PROD.
This commit is contained in:
parent
f20b5f6293
commit
76df151507
1 changed files with 12 additions and 9 deletions
21
src/app.ts
21
src/app.ts
|
@ -104,15 +104,6 @@ export class GBServer {
|
||||||
server.use(bodyParser.json());
|
server.use(bodyParser.json());
|
||||||
server.use(bodyParser.urlencoded({ extended: true }));
|
server.use(bodyParser.urlencoded({ extended: true }));
|
||||||
|
|
||||||
// Setups unsecure http redirect.
|
|
||||||
|
|
||||||
server.use(function (request, response, next) {
|
|
||||||
if (process.env.NODE_ENV != 'development' && !request.secure) {
|
|
||||||
return response.redirect("https://" + request.headers.host + request.url);
|
|
||||||
}
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Setups global error handlers.
|
// Setups global error handlers.
|
||||||
|
|
||||||
process.on('unhandledRejection', (err, p) => {
|
process.on('unhandledRejection', (err, p) => {
|
||||||
|
@ -287,6 +278,18 @@ export class GBServer {
|
||||||
})();
|
})();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Setups unsecure http redirect.
|
||||||
|
|
||||||
|
const httpServer = express();
|
||||||
|
httpServer.use(function (request, response, next) {
|
||||||
|
if (process.env.NODE_ENV != 'development' && !request.secure) {
|
||||||
|
return response.redirect("https://" + request.headers.host + request.url);
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (process.env.CERTIFICATE_PFX) {
|
if (process.env.CERTIFICATE_PFX) {
|
||||||
const options1 = {
|
const options1 = {
|
||||||
passphrase: process.env.CERTIFICATE_PASSPHRASE,
|
passphrase: process.env.CERTIFICATE_PASSPHRASE,
|
||||||
|
|
Loading…
Add table
Reference in a new issue