Skip to content

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

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

Activity

  1. self-assigned this
    on Nov 21, 2025
  2. added theissue type on Nov 21, 2025
  3. added a commit that references this issue on Nov 21, 2025
    3d4954f
  4. added 2 commits that reference this issue on Nov 24, 2025
    03e2312
    f05d520
  5. linked a pull request that will close this issueCherry-pick 31904 to v20 #31927on Nov 24, 2025
  6. added a commit that references this issue on Nov 24, 2025
    4dac5f2
  7. added a commit that references this issue on Nov 24, 2025
    cceb862
  8. angular-automatic-lock-bot commented on Dec 25, 2025

    @angular-automatic-lock-bot

    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.

  9. locked and limited conversation to collaborators on Dec 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions