When users visit alpha.atoz.amazon.dev, they end up on atoz.integ.amazon.com after login.
The root cause: the deconsolidated login page uses hardcoded absolute URLs (e.g., https://atoz-login.integ.amazon.com/login?loginType=AA) that break the X-ATOZ-SOURCE header mechanism needed for the domain migration.
LPT (Ruby) → CloudFormation Param → StaticCopyCustomResource → S3 bundle
aa_authentication_controller_url() → AaAuthenticationControllerUrl → replaces {{...}} in built JS → served to browser
In the React code, the placeholders look like:
// LoginForm.tsx — the main AA login form
const aaAuthenticationControllerUrl =
(source === "ac") ? "{{AaAuthenticationControllerUrl}}" : "{{AaEsspUrl}}";
formRef.current!.action = aaAuthenticationControllerUrl;
// DeconsolidatedLoginScreenV2.tsx — the DA tile
href={"{{DaAuthenticationControllerUrl}}"}
// Other tiles
href={"{{PbAuthenticationControllerUrl}}"}
href={"{{SruAuthenticationControllerUrl}}"}
After deploy, these become actual URLs like https://atoz-login.integ.amazon.com/login?loginType=AA.
Replace the {{*AuthenticationControllerUrl}} template values with relative paths (/login?loginType=XX) directly in the React components. Since the deconsolidated login page is already served from the Auth Controller's CloudFront distribution (same origin as /login), relative URLs naturally stay on whatever domain the user is currently on.
AtoZIdentityAppWebsite/src/components/LoginForm.tsx:
// BEFORE:
const aaAuthenticationControllerUrl: string =
(source === ParameterNames.REQUEST_SOURCE_AUTHENTICATION_CONTROLLER) ?
"{{AaAuthenticationControllerUrl}}" : "{{AaEsspUrl}}";
// AFTER:
const aaAuthenticationControllerUrl: string =
(source === ParameterNames.REQUEST_SOURCE_AUTHENTICATION_CONTROLLER) ?
"/login?loginType=AA" : "{{AaEsspUrl}}";
AtoZIdentityAppWebsite/src/components/DeconsolidatedLoginScreenV2.tsx:
// BEFORE:
const newHref = (source === ParameterNames.REQUEST_SOURCE_AUTHENTICATION_CONTROLLER) ?
"{{DaAuthenticationControllerUrl}}" : "{{DaEsspUrl}}";
// AFTER:
const newHref = (source === ParameterNames.REQUEST_SOURCE_AUTHENTICATION_CONTROLLER) ?
"/login?loginType=DA" : "{{DaEsspUrl}}";
// BEFORE:
href={"{{PbAuthenticationControllerUrl}}"}
// AFTER:
href={"/login?loginType=PB"}
// BEFORE:
href={"{{SruAuthenticationControllerUrl}}"}
// AFTER:
href={"/login?loginType=SRU"}
Other components (CSGO region pages, Jobseeker, etc.) — same pattern: replace {{*AuthenticationControllerUrl}} with /login?loginType=XX.
wzhongwe.atoz-apps-alpha.integ.amazon.com){{AaEsspUrl}} (non-AC) path still uses absolute URLs, but those go to the portal domain which is a different CloudFront distribution, so relative wouldn't work for themsource parameter logic — the source === "ac" branch is the only one that should use relative URLs (when the page is served from the AC distribution)?source=ac, the ESSP URLs are still absolute (but this is a different flow and not broken by this bug)?source=ac parameter guarantees the page is served from the AC distribution, so /login resolves correctlyChange all *_authentication_controller_url methods in website_template.rb to emit new-domain URLs for pre-prod stages.
AtoZIdentityAppLPT/lib/amazon/lpt/website_template.rb:
# BEFORE:
def aa_authentication_controller_url(options)
if options.logical_stage.name.downcase == "beta"
url = "https://atoz-login.integ.amazon.com/login?loginType=AA"
elsif options.logical_stage.name.downcase == "gamma"
url = "https://atoz-login-gamma.corp.amazon.com/login?loginType=AA"
elsif options.logical_stage.name.downcase == "prod-na"
url = "https://atoz-login.amazon.work/login?loginType=AA"
end
url
end
# AFTER:
def aa_authentication_controller_url(options)
if options.logical_stage.name.downcase == "beta"
url = "https://login.beta.atoz.amazon.dev/login?loginType=AA"
elsif options.logical_stage.name.downcase == "gamma"
url = "https://login.gamma.atoz.amazon.dev/login?loginType=AA"
elsif options.logical_stage.name.downcase == "prod-na"
url = "https://atoz-login.amazon.work/login?loginType=AA"
end
url
end
Repeat for ALL helper methods:
da_authentication_controller_urldspa_authentication_controller_urldsp_authentication_controller_urlcsgo_authentication_controller_url_nacsgo_authentication_controller_url_eucsgo_authentication_controller_url_fesru_authentication_controller_urlpb_authentication_controller_urljobseeker_authentication_controller_urlatoz-login.integ.amazon.com) would get redirected to the new domain mid-flow, potentially breaking cookieswzhongwe.atoz-apps-alpha.integ.amazon.com don't have a corresponding login.wzhongwe.atoz.amazon.dev domainlogin.alpha.atoz.amazon.dev and login.beta.atoz.amazon.dev from the same bundlebeta stage in LPT covers both)Replace the template placeholders with dynamic URL construction using the browser's current origin.
AtoZIdentityAppWebsite/src/components/LoginForm.tsx:
// BEFORE:
const aaAuthenticationControllerUrl: string =
(source === ParameterNames.REQUEST_SOURCE_AUTHENTICATION_CONTROLLER) ?
"{{AaAuthenticationControllerUrl}}" : "{{AaEsspUrl}}";
// AFTER:
const aaAuthenticationControllerUrl: string =
(source === ParameterNames.REQUEST_SOURCE_AUTHENTICATION_CONTROLLER) ?
`${window.location.origin}/login?loginType=AA` : "{{AaEsspUrl}}";
Same pattern for all other *AuthenticationControllerUrl usages.
window.location.origin + "/login?loginType=AA" is the same as just /login?loginType=AA for same-origin navigationwindow.location doesn't exist (not currently an issue since this is a static S3 app)/login, relative is simplerOption A is the clear winner:
The key insight: when source === "ac", the page is ALWAYS served from the AC distribution. So /login is guaranteed to resolve to the correct Auth Controller endpoint on the same domain the user is already on.
{{*AuthenticationControllerUrl}} usages in AtoZIdentityAppWebsite/src/source === "ac" branches*AuthenticationControllerUrl parameters (separate follow-up CR to avoid risk)alpha.atoz.amazon.dev| File | Change |
|---|---|
AtoZIdentityAppWebsite/src/components/LoginForm.tsx | Replace "{{AaAuthenticationControllerUrl}}" with "/login?loginType=AA" |
AtoZIdentityAppWebsite/src/components/DeconsolidatedLoginScreenV2.tsx | Replace DA, PB, SRU controller URLs with relative paths |
| Any CSGO region components | Replace {{CsgoAuthenticationControllerUrl*}} with /login?loginType=CSGO®ion_hint=XX |
| Any Jobseeker components | Replace {{JobseekerAuthenticationControllerUrl}} with /login?loginType=JOBSEEKER |
AtoZIdentityAppWebsite/src/components/__tests__/* | Update test expectations |
AtoZIdentityAppWebsite/configuration/webpack.config.js | Can remove the AC URL template entries (optional cleanup) |
After deploying to alpha:
https://alpha.atoz.amazon.devhttps://login.alpha.atoz.amazon.dev/loginhttps://login.alpha.atoz.amazon.dev/?source=achttps://login.alpha.atoz.amazon.dev/login?loginType=AA (relative → same origin)https://alpha.atoz.amazon.dev/ (not atoz.integ.amazon.com)Also verify DA, PB, SRU, CSGO tiles navigate to relative /login?loginType=XX paths.
comments (0)