Infinite admin login loop with production build
See original GitHub issueBug report
Describe the bug
When running the Users starter project in production mode, you can’t reach the Admin UI. You keep getting prompted to login.
To Reproduce
- Create a new test project using
yarn create keystone-app
. Select the Users starter. - Run the project in dev mode with the auth strategy temporarily removed so you can create an initial user.
- Log out and close the server.
- Restart the server in dev mode to verify your new User can log in and get to the admin UI.
- Log out and close the server.
- Run
yarn build && yarn start
. - Try to access the Admin UI. You’ll get the login page as before. However, every time you log in you just end up back at the login screen. You can never reach the admin UI.
Expected Behavior
Should end up in the admin UI as in dev mode. Trying to navigate to localhost:3000/admin
still sends you to the login page.
System information
- OS: Windows 10 1903
- Browser (if applies): Chrome 78
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:8 (8 by maintainers)
Top Results From Across the Web
[SOLVED] Infinite redirect loop on login | Drupal.org
When any user (except admin) logs in, the site goes into a redirect loop. ... It's a production site and clients need to...
Read more >laravel login infinite loop after deployment - php - Stack Overflow
domain.dev displays the admin dashboard if logged in, and the login page if not, while logging out returns the user to the login...
Read more >Redirect loop when trying to login to /wp-admin/ [duplicate]
Stuck in an infinite loop when trying to log in to my wordpress site. I type in the URL/wp-admin and then it loops...
Read more >OpenShift Web Console stuck in redirect loop
Logging into the admin cluster console throws an "Oh no! Something went wrong" error and redirects to the login page which then automatically ......
Read more >Stuck in authorization login loop - Microsoft Q&A
/// <response code="400">If the redirect Url and state could not be built</response>; [HttpGet(Name = nameof( ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The problem here is related to secure cookies
By default, Keystone will use secure cookies in production, with the assumption that you will be running over HTTPS.
The workaround if you don’t want to/can’t run HTTPS in production mode is to explicitly turn of secure cookies:
@MadeByMike Could you work out where the best place is for this information to live in the documentation, because it’s definitely going to catch everyone when they first try to run in “production”.
There’s some info related to this in my write up on Secure Cookies and Reverse Proxies.