dlwagner / issue-tracker

issue-tracker built with express, mongoose, mongodb-Atlas
1 stars 0 forks source link

Too many redirects(Chrome) / The page isn’t redirecting properly(Firefox) #3

Closed dlwagner closed 4 years ago

dlwagner commented 4 years ago

This problem occurs with the production app. The local dev version(running on localhost) works fine.

Steps to reproduce:

  1. Clear cookies
  2. Navigate to app url https://mysterious-escarpment-61469.herokuapp.com/
  3. Auth0 login box shows up
  4. Login with username/pwd
  5. hit enter
  6. error page shows (Too many redirects(Chrome) / The page isn’t redirecting properly(Firefox))

Auth0 dashboard shows a successful login. Browser dev tools show repeated trips to /login. Application server logs show the same thing as browser dev tools.

Browser Dev Tools / Network Tab events: this one event(three lines below) repeated 6 or 7 times:

302 GET mysterious-escarpment-61469.herokuapp.com login document html 457 B 0 B

302 GET issue-tracker-dev.auth0.com authorize?nonce=2b116f0d0bde39c1187272e96238ad04&response_type=code&redirect_uri=https://mysterious-escarpment-61469.herokuapp.com/callback&scope=openid email profile&state=eGMa6fhDRbld9pPHZcSZJ0E3&client_id=LeWCaaOWxCXJGgsBRMLSq9jSudC79Giy document html 974 B 0 B

302 GET mysterious-escarpment-61469.herokuapp.com callback?code=McEwa3YnVEMqG634&state=eGMa6fhDRbld9pPHZcSZJ0E3 document html 230 B 0 B

Application Server Logs: (These several lines repeated for about 6 or 7 times:

Jan 30 15:01:10 mysterious-escarpment-61469 app/web.1 GET /login 302 6.014 ms - 0

Jan 30 15:01:10 mysterious-escarpment-61469 heroku/router at=info method=GET path="/callback?code=McEwa3YnVEMqG634&state=eGMa6fhDRbld9pPHZcSZJ0E3" host=mysterious-escarpment-61469.herokuapp.com request_id=c28143cc-4fcd-496d-9618-aa9871f4fb4e fwd="108.194.128.9" dyno=web.1 connect=0ms service=7ms status=302 bytes=249 protocol=https

Jan 30 15:01:10 mysterious-escarpment-61469 heroku/router at=info method=GET path="/login" host=mysterious-escarpment-61469.herokuapp.com request_id=7b1d0ea0-b69c-4756-97d1-60aaeec99395 fwd="108.194.128.9" dyno=web.1 connect=0ms service=12ms status=302 bytes=420 protocol=https

Jan 30 15:01:10 mysterious-escarpment-61469 app/web.1 GET /callback?code=McEwa3YnVEMqG634&state=eGMa6fhDRbld9pPHZcSZJ0E3 302 2.114 ms - 56

dlwagner commented 4 years ago

RESOLVED:

Added the following line to app.js:

app.set('trust proxy', 1);