Skip to content

fix(@angular/ssr): use createRedirectResponse for i18n base-path redirects#32815

Open
artahir-dev wants to merge 1 commit intoangular:mainfrom
artahir-dev:fix/ssr-accept-language-redirect-use-shared-helper
Open

fix(@angular/ssr): use createRedirectResponse for i18n base-path redirects#32815
artahir-dev wants to merge 1 commit intoangular:mainfrom
artahir-dev:fix/ssr-accept-language-redirect-use-shared-helper

Conversation

@artahir-dev
Copy link

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

The Accept-Language redirect path in AngularAppEngine constructs a redirect response directly instead of using the shared redirect helper. As a result, that path does not include forwarded prefix context in Location, and the Vary header omits X-Forwarded-Prefix.

Issue Number: N/A

What is the new behavior?

The locale redirect path now uses createRedirectResponse, matching the rest of SSR redirect handling. Redirect responses now:

  • Build Location with X-Forwarded-Prefix when present.
  • Include Vary: X-Forwarded-Prefix, Accept-Language.

Regression tests were added to verify both header semantics and prefixed redirect behavior.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

This PR is intentionally scoped to the Accept-Language base-path redirect flow.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the i18n base-path redirect logic to use the shared createRedirectResponse helper. This change correctly incorporates the X-Forwarded-Prefix into the redirect Location and adds it to the Vary header, ensuring consistent behavior with other redirects in the SSR engine. The accompanying test changes validate this new behavior, including an updated test for the Vary header and a new test for prefixed redirects. The implementation appears correct and addresses the described issue.

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.

1 participant