Skip to content

Commit 7f37913

Browse files
feat(website): redirect http to https in production
1 parent 5ddedc4 commit 7f37913

File tree

1 file changed

+9
-0
lines changed
  • packages/overmind-website/backend

1 file changed

+9
-0
lines changed

packages/overmind-website/backend/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,15 @@ const googleCrawlMiddleware = async function ssr(req, res, next) {
130130
}
131131
}
132132

133+
if (IS_PRODUCTION) {
134+
app.use((req, res, next) => {
135+
if (req.secure) {
136+
next()
137+
} else {
138+
res.redirect('https://' + req.headers.host + req.url)
139+
}
140+
})
141+
}
133142
app.use(googleCrawlMiddleware)
134143
app.use(express.static(path.join(__dirname, '..', 'dist')))
135144
app.use('/images', express.static(path.join(__dirname, '..', 'images')))

0 commit comments

Comments
 (0)