From be9557b8a9f56742651ae6e8f04780e81d15ab06 Mon Sep 17 00:00:00 2001 From: JayWll Date: Wed, 6 May 2020 08:35:49 -0600 Subject: [PATCH] Simplifying redirection code for requests to the root domain --- nodeapp/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nodeapp/app.js b/nodeapp/app.js index e721604..129c2fe 100644 --- a/nodeapp/app.js +++ b/nodeapp/app.js @@ -7,10 +7,10 @@ const app = express(); // Handle requests for the root page by serving the static index.html from the views folder app.get("/", function(req, res) { - if (!req.headers['x-real-host'] && req.headers.host.includes('glitch.me')) { + if (req.headers.host.includes('glitch.me')) { return res.redirect('https://www.jasonsplant.ml' + req.url); } - + res.sendFile(__dirname + "/views/index.html"); });