Repository navigation
SSR causes 302 redirects to normalized URL #33053
Copy link
Copy link
Labels
area: @angular/ssrfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelygemini-triagedLabel noting that an issue has been triaged by geminiLabel noting that an issue has been triaged by geminiseverity3: broken
Description
Command
serve
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
Previously someone pointed out that SSR causes lots of 302 redirects (#31881).
The fix landed in #31883 but we are still facing the similar issue for other URL patterns.
I expect that Angular server returns 200 OK and then URL normalization happens solely on the client side.
/?emptyredirects to/?empty=/?scope=email+profileredirects to/?scope=email%20profile/?bbb=1&aaa=2&bbb=3redirects to/?bbb=1&bbb=3&aaa=2//fooredirects to/foo
Minimal Reproduction
ng serve and access to URLs above
export const serverRoutes: ServerRoute[] = [
{
path: '**',
renderMode: RenderMode.Server,
},
];Exception or Error
Your Environment
Angular CLI : 21.2.8
Angular : 21.2.10
Node.js : 24.15.0
Package Manager : pnpm 10.26.1
Operating System : darwin arm64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 21.2.8 │ ^21.2.8 │
│ @angular/cdk │ 21.2.8 │ ^21.2.8 │
│ @angular/cli │ 21.2.8 │ ^21.2.8 │
│ @angular/common │ 21.2.10 │ ^21.2.10 │
│ @angular/compiler │ 21.2.10 │ ^21.2.10 │
│ @angular/compiler-cli │ 21.2.10 │ ^21.2.10 │
│ @angular/core │ 21.2.10 │ ^21.2.10 │
│ @angular/forms │ 21.2.10 │ ^21.2.10 │
│ @angular/material │ 21.2.8 │ ^21.2.8 │
│ @angular/platform-browser │ 21.2.10 │ ^21.2.10 │
│ @angular/platform-server │ 21.2.10 │ ^21.2.10 │
│ @angular/router │ 21.2.10 │ ^21.2.10 │
│ @angular/ssr │ 21.2.8 │ ^21.2.8 │
│ rxjs │ 7.8.2 │ ^7.8.2 │
│ typescript │ 5.9.3 │ ^5.9.3 │
│ vitest │ 4.1.4 │ ^4.1.4 │
└───────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: @angular/ssrfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelygemini-triagedLabel noting that an issue has been triaged by geminiLabel noting that an issue has been triaged by geminiseverity3: broken
Activity
alan-agius4 commentedon Apr 25, 2026
This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please?
You can read here why this is needed. A good way to make a minimal repro is to create a new app via
ng new repro-appand adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.This might be related to your directory structure so its really important to get an accurate repro to diagnose this.
kon72 commentedon Apr 25, 2026
Hi @alan-agius4 ,
I created a minimal repro for this issue: https://github.com/kon72/angular-ssr-redirect-repro
All four requests should result in 302 redirect. (This is curl with HEAD method for brevity, but the same happens with browser requests.)
fix(@angular/ssr): use router to normalize URLs for comparison
fix(@angular/ssr): use router to normalize URLs for comparison
fix(@angular/ssr): use router to normalize URLs for comparison
fix(@angular/ssr): use router to normalize URLs for comparison
fix(@angular/ssr): use router to normalize URLs for comparison
angular-automatic-lock-bot commentedon May 29, 2026
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.