From 8a04ad2354f7242296ac8d90bfddb52081fef1d8 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Sun, 9 Jul 2023 17:09:32 -0300 Subject: [PATCH] fix(all): Minor changes in PROD. --- src/app.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/app.ts b/src/app.ts index b241ec33..0acdd8cb 100644 --- a/src/app.ts +++ b/src/app.ts @@ -280,16 +280,14 @@ export class GBServer { // Setups unsecure http redirect. - const httpServer = express(); - httpServer.use( (request, response, next) => { - if (request.headers.host != 'localhost' && !request.secure) { - return response.redirect("https://" + request.headers.host + request.url); - } - next(); - }); - const httpDefaultPort = 80; - httpServer.listen(httpDefaultPort); + const server1 = http.createServer((req,res)=>{ + + res.writeHead(301, { + Location: "https://" + req.headers.host + req.url + }).end(); + }); + server1.listen(80); if (process.env.CERTIFICATE_PFX) { const options1 = {