Skip to content

Commit

Permalink
heroku force ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
KATT committed Jul 19, 2021
1 parent b37d816 commit 28511aa
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -13,6 +13,15 @@ const handle = app.getRequestHandler();

app.prepare().then(() => {
const server = http.createServer((req, res) => {
const proto = req.headers['x-forwarded-proto'];
if (proto && proto === 'http') {
// redirect to ssl
res.writeHead(303, {
location: `https://` + req.headers.host + (req.headers.url ?? ''),
});
res.end();
return;
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const parsedUrl = parse(req.url!, true);
handle(req, res, parsedUrl);
Expand Down

2 comments on commit 28511aa

@vercel
Copy link

@vercel vercel bot commented on 28511aa Jul 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

www – ./www

trpc.io
www.tmp.trpc.io
www-git-main.tmp.trpc.io
www.trpc.io

@vercel
Copy link

@vercel vercel bot commented on 28511aa Jul 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

todomvc – ./examples/next-prisma-todomvc

todomvc.trpc.io
todomvc.tmp.trpc.io
todomvc-git-main.tmp.trpc.io
trpc.tmp.trpc.io

Please sign in to comment.