Skip to content

CN Redirect Update 2#294

Merged
express-milo-merge-bot[bot] merged 22 commits intostagefrom
cn-redirect-2
Apr 22, 2026
Merged

CN Redirect Update 2#294
express-milo-merge-bot[bot] merged 22 commits intostagefrom
cn-redirect-2

Conversation

@echen-adobe
Copy link
Copy Markdown
Contributor

@echen-adobe echen-adobe commented Apr 3, 2026

Summary

Briefly describe the features or fixes introduced in this PR.

Gracefully redirect user to 404 page if the country param is cn and the content does not exist.


Jira Ticket

Resolves: https://jira.corp.adobe.com/browse/MWPW-191183


Test URLs

Env URL
Before https://main--da-express-milo--adobecom.aem.page/express/
After https://cn-redirect-2--da-express-milo--adobecom.aem.page/express/drafts/lingo/selector?milolibs=acommarketselector&country=cn
After https://cn-redirect-2--da-express-milo--adobecom.aem.page/express/dradsfdsfts/lingo/selector?milolibs=acommarketselector&country=cn
After https://cn-redirect-2--da-express-milo--adobecom.aem.page/cn/express/
After https://cn-redirect-2--da-express-milo--adobecom.aem.page/express/drafts/lingo/selector?milolibs=acommarketselector&country=fr
After https://cn-redirect-2--da-express-milo--adobecom.aem.page/cn

Verification Steps

  • Steps to reproduce the issue or view the new feature.
  • What to expect before and after the change.
  • Visit the first link. The user should be directed to a 404
  • Visit the second link, an obviously malformed one. This should also gracefully redirect.
  • Visit the third one, this should still function normally
  • Fourth one is the original French link, should work normally
  • Fifth one is the infinite loop edge case, ensure that it redirects to a 404 now.

@aem-code-sync
Copy link
Copy Markdown

aem-code-sync Bot commented Apr 3, 2026

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

@echen-adobe echen-adobe changed the title Update scripts.js CN Redirect Update 2 Apr 6, 2026
@echen-adobe echen-adobe marked this pull request as ready for review April 7, 2026 14:34
@echen-adobe echen-adobe requested a review from JingleH April 7, 2026 19:19
Copy link
Copy Markdown
Contributor

@fullcolorcoder fullcolorcoder 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, added a suggested commit for a lana log on fail.

const isAdobeOrigin = /^(www\.stage\.|www\.)adobe\.com$/.test(window.location.hostname);
import('./utils/location-utils.js').then(({ getCountry }) => getCountry()).then((country) => {
if (country === 'cn') { window.location.href = '/cn'; }
if (country === 'cn' && isAdobeOrigin && !window.location.pathname.startsWith('/cn') && !window.isErrorPage) { window.location.href = '/cn'; }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (country === 'cn' && isAdobeOrigin && !window.location.pathname.startsWith('/cn') && !window.isErrorPage) { window.location.href = '/cn'; }
if (country === 'cn' && isAdobeOrigin && !window.location.pathname.startsWith('/cn') && !window.isErrorPage) { window.location.href = '/cn'; }
}).catch((err) => {
window.lana?.log(`CN redirect failed: ${err}`, { tags: 'scripts', severity: 'error' });
});

@express-milo-merge-bot
Copy link
Copy Markdown
Contributor

Skipped merging 294: CN Redirect Update 2 due to failing or running checks

2 similar comments
@express-milo-merge-bot
Copy link
Copy Markdown
Contributor

Skipped merging 294: CN Redirect Update 2 due to failing or running checks

@express-milo-merge-bot
Copy link
Copy Markdown
Contributor

Skipped merging 294: CN Redirect Update 2 due to failing or running checks

@express-milo-merge-bot express-milo-merge-bot Bot merged commit 899f1aa into stage Apr 22, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants