From 9d01b91ef9990e375847328fa7da26b07b09db7d Mon Sep 17 00:00:00 2001 From: alexlee-dev Date: Fri, 31 Jul 2020 09:17:44 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=90=20Forward=20Heroku=20to=20GitHubJo?= =?UTF-8?q?bs.io=20#46=20-=20Add=20Redirect=20in=20Server?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/app.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/server/app.ts b/src/server/app.ts index 3293fa3..e37edf7 100644 --- a/src/server/app.ts +++ b/src/server/app.ts @@ -74,6 +74,10 @@ class App { this.app.use(express.static(path.join(__dirname, "../dist"))); this.app.get("*", (req: Request, res: Response) => { + console.log({ hostname: req.hostname }); + if (req.hostname === "herokuapp") { + return res.status(308).redirect("https://www.githubjobs.io/"); + } res.sendFile(path.join(__dirname, "../dist/index.html")); }); }