Skip to content

Commit

Permalink
Merge pull request #528 from nextstrain/www-redirect
Browse files Browse the repository at this point in the history
Add www to apex redirect via express middleware
  • Loading branch information
trvrb authored Mar 21, 2018
2 parents 4408de0 + 7105896 commit 2e184f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
"es6-object-assign": "^1.1.0",
"es6-promise-polyfill": "^1.2.0",
"express": "^4.13.3",
"express-naked-redirect": "^0.1.2",
"express-static-gzip": "^0.2.2",
"leaflet": "^1.2.0",
"leaflet-image": "^0.4.0",
Expand Down
5 changes: 5 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ if (devServer) {
app.use('/dist', express.static('dist')); // why is this line here?
}

/* redirect www.nextstrain.org to nextstrain.org */
app.use(require('express-naked-redirect')({
reverse: true
}));

/* loader.io token (needed to run tests) */
app.get("/loaderio-b65b3d7f32a7febf80e8e05678347cb3.txt", (req, res) => {
res.sendFile(path.join(__dirname, "loader.io-token.txt"));
Expand Down

0 comments on commit 2e184f9

Please sign in to comment.