Skip to content

SSR redirect loop with custom base href (>=20.3.7) #31902

@pf-vkocib

Description

@pf-vkocib

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

20.3.6

Description

In our app, we optionally use the X-Forwarded-Prefix header to configure the base href. This works correctly in version 20.3.6, but after upgrading to 20.3.7 (and in later versions including v21), we encounter a redirect loop when a custom base href is used. The issue does not occur when the default base href is used.

  • domain.com – 200 OK
  • domain.com/app – 302 Found (redirect loop)

Minimal Reproduction

https://github.com/pf-vkocib/angular-ssr-20.3.7-redirect-loop-reproduction

  1. configure local nginx based on example-nginx.conf
  2. npm install
  3. npm run serve:ssr:ssr-redirect-loop
  4. visit localhost/app

(v20.3.6 branch uses previous version and it is ok)

Exception or Error

ERR_TOO_MANY_REDIRECTS 

Your Environment

Angular CLI: 20.3.7 Node: 20.19.2 Package Manager: npm 10.8.2 OS: darwin arm64 Angular: 20.3.13 ... common, compiler, compiler-cli, core, forms ... platform-browser, platform-server, router Package Version ------------------------------------ @angular-devkit/architect 0.2003.7 @angular-devkit/core 20.3.7 @angular-devkit/schematics 20.3.7 @angular/build 20.3.7 @angular/cli 20.3.7 @angular/ssr 20.3.7 @schematics/angular 20.3.7 rxjs 7.8.2 typescript 5.9.3 zone.js 0.15.1 

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