Skip to content

Commit

Permalink
fix: enforce https when redirecting from www to apex domain
Browse files Browse the repository at this point in the history
  • Loading branch information
wKovacs64 committed Aug 6, 2022
1 parent 61d630a commit abb8053
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const app = express();
app.use((req, res, next) => {
if (req.hostname.startsWith('www')) {
const apexHostname = req.hostname.replace('www.', '');
res.redirect(301, `${req.protocol}://${apexHostname}${req.originalUrl}`);
res.redirect(301, `https://${apexHostname}${req.originalUrl}`);
} else {
next();
}
Expand Down

0 comments on commit abb8053

Please sign in to comment.