Skip to content

Angular AppEngine i18 redirect includes full domain #29514

Closed
@jmbarbier

Description

@jmbarbier

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

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions