From c79d226aff201ad2e3ef6149b1f085a349b8bd52 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Sun, 9 Jul 2023 20:09:55 -0300 Subject: [PATCH] BREAKING CHANGE: General Bots is now 3.0. --- src/app.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app.ts b/src/app.ts index 0acdd8cb..7e962fa7 100644 --- a/src/app.ts +++ b/src/app.ts @@ -280,13 +280,14 @@ export class GBServer { // Setups unsecure http redirect. - const server1 = http.createServer((req,res)=>{ - + const server1 = http.createServer((req, res) => { + const host = req.headers.host.startsWith('www.') ? + req.headers.host.substring(4) : req.headers.host; res.writeHead(301, { - Location: "https://" + req.headers.host + req.url + Location: "https://" + host + req.url }).end(); - }); - + }); + server1.listen(80); if (process.env.CERTIFICATE_PFX) {