Skip to content

Commit

Permalink
🌐 Forward Heroku to GitHubJobs.io #46 - Try using 'req.hostname'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlee-dev committed Aug 13, 2020
1 parent 32c5420 commit b07f86d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/server/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b07f86d

Please sign in to comment.