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

Angular AppEngine i18 redirect includes full domain #29514

Closed
1 task
jmbarbier opened this issue Jan 29, 2025 · 1 comment · Fixed by #29518
Closed
1 task

Angular AppEngine i18 redirect includes full domain #29514

jmbarbier opened this issue Jan 29, 2025 · 1 comment · Fixed by #29518
Assignees
Labels
area: @angular/ssr freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix

Comments

@jmbarbier
Copy link

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

While serving a i18n using AngularNodeAppEngine, the base path i18n redirect uses the full URL to do the 302 redirect to i18n subpaths.

https://github.com/angular/angular-cli/blob/main/packages/angular/ssr/src/app-engine.ts#L120

If the application is not served directly on the real domain (ex: using a cdn or cloud run), the redirect issued is redirecting to the bad domain.

browser : example.com  ----> cdn/reverse proxy  ---> app.cloud.run.domain
                                                                |
                                                           redirect 302 to
   browser            <----------------------------  app.cloud.run.domain/de/
       |                                                         
handle redirect       ------------------------------> app.cloud.run.domain/de/

Only redirecting to /de/ path instead of full url should be enough.

Minimal Reproduction

Create a ssr i18n app
Host it on google cloud run (url : app.cloud.run.domain)
Point to it using any cdn/reverse proxy (url: example.com)
Navigate to naked domain example.com
Browser is redirected to app.cloud.run.domain/de

Exception or Error


Your Environment

Angular CLI: 19.1.4
Node: 22.6.0
Package Manager: npm 10.8.2
OS: linux x64

Angular: 19.1.3
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic
... platform-server, router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1901.4
@angular-devkit/build-angular   19.1.4
@angular-devkit/core            19.1.4
@angular-devkit/schematics      19.1.4
@angular/cli                    19.1.4
@angular/ssr                    19.1.4
@schematics/angular             19.1.4
rxjs                            7.8.1
typescript                      5.7.3

Anything else relevant?

No response

@alan-agius4 alan-agius4 self-assigned this Jan 29, 2025
@alan-agius4 alan-agius4 added type: bug/fix freq1: low Only reported by a handful of users who observe it rarely severity3: broken area: @angular/ssr labels Jan 29, 2025
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 29, 2025
When redirecting to the preferred locale, the previous implementation used the full URL for the 302 redirect to i18n subpaths based on the user's preferred locale. This update ensures that the redirect now uses the locale-specific pathname instead of the full URL.

Closes angular#29514
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 29, 2025
When redirecting to the preferred locale, the previous implementation used the full URL for the 302 redirect to i18n subpaths based on the user's preferred locale. This update ensures that the redirect now uses the locale-specific pathname instead of the full URL.

Closes angular#29514
alan-agius4 added a commit that referenced this issue Jan 29, 2025
When redirecting to the preferred locale, the previous implementation used the full URL for the 302 redirect to i18n subpaths based on the user's preferred locale. This update ensures that the redirect now uses the locale-specific pathname instead of the full URL.

Closes #29514
alan-agius4 added a commit that referenced this issue Jan 29, 2025
When redirecting to the preferred locale, the previous implementation used the full URL for the 302 redirect to i18n subpaths based on the user's preferred locale. This update ensures that the redirect now uses the locale-specific pathname instead of the full URL.

Closes #29514

(cherry picked from commit 46581db)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @angular/ssr freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants