Skip to content

404 when SSR encounters slashes in route params #33044

@undsoft

Description

@undsoft

Which @angular/* package(s) are the source of the bug?

platform-server

Is this a regression?

No

Description

  1. Have a parametrized route:
{ path: 'user/:name', component: UserProfile }
  1. Use server side rendering on the route.
  2. Have a router link that puts slash in the :name:
<a [routerLink]="['/user', 'Bob / Roberts']">Go to Bob / Roberts profile</a>
  1. Follow the link.

Navigation will succeed in client mode and you'll see encoded param in the URL as expected.
But if you reload the page / navigate to this URL directly, you'll get 404.

Please provide a link to a minimal reproduction of the bug

https://github.com/undsoft/angular-ssr-slash-repro

Please provide the environment you discovered this bug in (run ng version)

Angular CLI       : 21.2.8
Angular           : 21.2.9
Node.js           : 24.14.0
Package Manager   : pnpm 10.33.0
Operating System  : darwin arm64

┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package                   │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build            │ 21.2.8            │ ^21.2.7           │
│ @angular/cli              │ 21.2.8            │ ^21.2.7           │
│ @angular/common           │ 21.2.9            │ ^21.2.0           │
│ @angular/compiler         │ 21.2.9            │ ^21.2.0           │
│ @angular/compiler-cli     │ 21.2.9            │ ^21.2.0           │
│ @angular/core             │ 21.2.9            │ ^21.2.0           │
│ @angular/forms            │ 21.2.9            │ ^21.2.0           │
│ @angular/platform-browser │ 21.2.9            │ ^21.2.0           │
│ @angular/platform-server  │ 21.2.9            │ ^21.2.0           │
│ @angular/router           │ 21.2.9            │ ^21.2.0           │
│ @angular/ssr              │ 21.2.8            │ ^21.2.7           │
│ rxjs                      │ 7.8.2             │ ~7.8.0            │
│ typescript                │ 5.9.3             │ ~5.9.2            │
│ vitest                    │ 4.1.5             │ ^4.0.8            │
└───────────────────────────┴───────────────────┴───────────────────┘

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions