Skip to content

Commit

Permalink
fix(haste-express): updated to work well with Heroku
Browse files Browse the repository at this point in the history
and other load balanced systems
  • Loading branch information
foundrium committed Feb 25, 2022
1 parent 812e293 commit 8e78b6a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/haste-express/lib/hasteAuthRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ passport.use(HasteStrategy.initialize());
router.get(
'/login',
function (req, res, next) {
const port = req.app.settings.port;
const port = process.env.NODE_ENV !== 'production' ? req.app.settings.port : 443;
passport.authenticate(
'auth0',
{
Expand Down Expand Up @@ -82,7 +82,8 @@ router.get('/logout', (req, res) => {
req.logout();

let returnTo = req.protocol + '://' + req.hostname;
const port = req.connection.localPort;
const port = process.env.NODE_ENV !== 'production' ? req.app.settings.port : 443;

if (port !== undefined && port !== 80 && port !== 443) {
returnTo += ':' + port;
}
Expand Down

0 comments on commit 8e78b6a

Please sign in to comment.