Skip to content

404 when SSR encounters slashes in route params #33044

Closed

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            │
└───────────────────────────┴───────────────────┴───────────────────┘

Activity

  1. SkyZeroZx commented on Apr 22, 2026

    @SkyZeroZx
    Contributor

    This might be related to issue angular/angular#68322 and the fix introduced in version 21.2.9 (#68194)

    Could you try version 21.2.8 to see if the same issue occurs?

  2. undsoft commented on Apr 22, 2026

    @undsoft
    Author

    There is no 21.2.8 for ssr package, but if I update other packages, the issue persists.

  3. SkyZeroZx commented on Apr 22, 2026

    @SkyZeroZx
    Contributor

    There is no 21.2.8 for ssr package, but if I update other packages, the issue persists.

    I didn't quite understand; currently, there's @angular/ssr version 21.2.8.
    On the other hand, this problem also occurs using Angular 21.2.8, which is probably due to something other than the fix (#68194).

    This also happens with Angular 21.0.0

  4. modified the milestone: needsTriage on Apr 22, 2026
  5. added a commit that references this issue on Apr 27, 2026
    8c926e8
  6. added theissue type on Apr 27, 2026
  7. self-assigned this
    on Apr 27, 2026
  8. added a commit that references this issue on Apr 28, 2026
    930ada9
  9. added a commit that references this issue on Apr 28, 2026
    53b9623
  10. angular-automatic-lock-bot commented on May 29, 2026

    @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.

  11. locked and limited conversation to collaborators on May 29, 2026
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