-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: unify login/logout dev routes for http servers #1641
Conversation
🦋 Changeset is good to goLatest commit: 567d3b5 We got this. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/commercetools/merchant-center-application-kit/g3st2mmgc |
@@ -1,7 +0,0 @@ | |||
module.exports = (env) => (request, response, next) => { | |||
if (!env.servedByProxy) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the original issue, where the disableAuthRoutesOfDevServer
wasn't taken into account.
With the new config, the servedByProxy
value is inferred from the node env or app env.
In the case of the auth app, when starting the app locally in production mode (NODE_ENV=production MC_APP_ENV=development
), the servedByProxy
is set to false, causing the dev login page to be rendered. However, for the auth app, we want to render the "real" login page and for that we need to use the disableAuthRoutesOfDevServer
.
packages/mc-dev-authentication/middlewares/create-login-middleware.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for covering the edge case.
This PR aims to fix an issue that we currently have with one of our internal apps, due to the new application config.
TL;DR: the login/logout dev pages that we use in the dev server and in the mc-http-server should only be used when the property
disableAuthRoutesOfDevServer
is explicitly passed or when the application is not running behind a proxy.