question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot access admin page in product environment

See original GitHub issue

Bug report

Cannot access admin page in product environment Project: demo-projects/meetup and custom with yarn create keystone-app ...

yarn build && yarn start

goto login page http://localhost:3000/admin/signin I tried with nuxt, next. The admin page is still accessible only in the dev environment

System information

  • OS: Windows

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:24 (15 by maintainers)

github_iconTop GitHub Comments

4reactions
Shinerisingcommented, Mar 13, 2020

My solution here: (And it works for me!)

  1. Enable Proxy Trust Middleware for Express (Edit your index.js of keystone)
module.exports = {
  keystone,
  apps: [
    new GraphQLApp(),
    new AdminUIApp(),
  ],
  configureExpress: app => {
    app.set('trust proxy', 1);
  }
};
  1. Set Proxy Headers (For me, the file to be edited is nginx.conf)
    location /admin/api {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Host $host;
      proxy_set_header X-Forwarded-Proto "https";
      proxy_set_header Host $host;
      proxy_pass http://app:3000; 
    }
  1. Set the Cookie Option as usual, then build your app and deploy it, and all is done!

Knowledge Page: https://expressjs.com/en/guide/behind-proxies.html

2reactions
michaelpaulcucciacommented, Feb 24, 2021

This worked for me, thanks @Shinerising

module.exports = {
  keystone,
  apps: [new GraphQLApp(),
  new AdminUIApp({
    name: PROJECT_NAME,
    enableDefaultRoute: true,
    authStrategy
  })
  ],
  //added for successful deployment
  configureExpress: app => {
    app.set('trust proxy', 1)
  }
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot missing environments - Power Platform
The troubleshooting steps should be carried out by an administrator of the environment with access to the environment in the Power Platform ...
Read more >
after copy prod site to local site cannot logon to wp-admin
I don't know how to access the site data bases etc if I cannot logon to wp-admin. I have used an alternate method....
Read more >
Log in to Admin and Product UI as admin fails in vROps ...
Log into the vRealize Operations Product UI as the local admin user. Navigate to Administration > Access > Access Control. · Navigate to ......
Read more >
Web2py on App Engine Local Environment: Cannot access ...
However I cannot seem to be able to access the admin interface. (The default page loads, when I access it from 127.0.0.1:8080.
Read more >
WP-Admin Not Working? Fix 'Can't Access WordPress Admin ...
Sometimes plugins can be the culprits behind these errors on your site. Since you don't have access to wp-admin, you'll need to disable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found