Skip to content
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

Merged
merged 3 commits into from
Jul 20, 2020

Conversation

emmenko
Copy link
Member

@emmenko emmenko commented Jul 20, 2020

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.

@changeset-bot
Copy link

changeset-bot bot commented Jul 20, 2020

🦋 Changeset is good to go

Latest commit: 567d3b5

We got this.

This PR includes changesets to release 6 packages
Name Type
@commercetools-frontend/mc-dev-authentication Patch
@commercetools-frontend/mc-http-server Patch
@commercetools-frontend/mc-scripts Patch
merchant-center-application-template-starter Patch
playground Patch
@commercetools-local/visual-testing-app Patch

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

@vercel
Copy link

vercel bot commented Jul 20, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/commercetools/merchant-center-application-kit/g3st2mmgc
✅ Preview: https://merchant-center-applic-git-nm-fix-http-server-dev-routes-051cb2.commercetools.vercel.app

@@ -1,7 +0,0 @@
module.exports = (env) => (request, response, next) => {
if (!env.servedByProxy) {
Copy link
Member Author

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.

@vercel vercel bot temporarily deployed to Preview July 20, 2020 10:31 Inactive
@vercel vercel bot temporarily deployed to Preview July 20, 2020 11:36 Inactive
@emmenko emmenko requested a review from tdeekens July 20, 2020 11:36
Copy link
Contributor

@tdeekens tdeekens left a 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.

@emmenko emmenko merged commit 77eb38a into master Jul 20, 2020
@emmenko emmenko deleted the nm-fix-http-server-dev-routes-config branch July 20, 2020 11:55
@github-actions github-actions bot mentioned this pull request Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants