From b07f86dcf5c4997369985123cf20d8158d9d4c0e Mon Sep 17 00:00:00 2001 From: alexlee-dev Date: Thu, 13 Aug 2020 07:27:46 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=90=20Forward=20Heroku=20to=20GitHubJo?= =?UTF-8?q?bs.io=20#46=20-=20Try=20using=20'req.hostname'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/app.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/server/app.ts b/src/server/app.ts index d32f659..4062a38 100644 --- a/src/server/app.ts +++ b/src/server/app.ts @@ -74,9 +74,16 @@ class App { this.app.use(express.static(path.join(__dirname, "../dist"))); this.app.get("*", (req: Request, res: Response) => { - if (req.headers.host === "gh-jobs.herokuapp.com") { + // if (req.headers.host === "gh-jobs.herokuapp.com") { + // return res.status(301).redirect("https://www.githubjobs.io/"); + // } + + if (req.hostname === "gh-jobs.herokuapp.com") { return res.status(301).redirect("https://www.githubjobs.io/"); } + + // ? Use this.app.all? + console.log( chalk.blueBright.inverse({ host: req.headers.host,