Skip to content

Conversation

@JustroX
Copy link

@JustroX JustroX commented Nov 26, 2025

This commit updates Angular SSR URL preprocessing to remove auxiliary outlet route segments before route matching. Previously, URLs containing auxiliary routes appended with outlet syntax, such as /path(foo:bar), could prevent correct route resolution.

A new stripAuxiliaryRoutes utility function has been added to strip these segments, ensuring that SSR route matching behaves consistently with client-side routing.

This issue is similar to #31457, and the fix is based from #31476

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Similar to #31457, Angular SSR seems not to accept URLs with auxiliary routes.

For example:

export const routes: Routes = [
  {
    path: '',
    pathMatch: 'full',
    redirectTo: '/lorem1',
  },
  {
    path: 'lorem1',
    component: Lorem1Component,
  },
  {
    path: 'lorem2',
    component: Lorem2Component,
    outlet: 'secondary',
  },
]

Running:

curl http://localhost:4200/lorem1\(secondary\:lorem2\)

<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /lorem1(secondary:lorem2)</pre>
</body>
</html>

Reproduction: https://stackblitz.com/edit/angular-ssr-matrix-params-denial-vly6p1dh?file=src%2Fapp%2Fapp-routes.ts

What is the new behavior?

The routes resolved correctly

curl http://localhost:4200/lorem1\(secondary\:lorem2\)

<!DOCTYPE html><html lang="en"><head>
    <script type="module" src="/@vite/client"></script>

    <title>Demo</title>
    <meta charset="UTF-8">
    <base href="/">
  </head>
  <body>
    <app-root ng-version="21.0.1" ng-server-context="ssr">

<router-outlet></router-outlet>
<lorem1>lorem1</lorem1>
<!--container--><br>
<router-outlet name="secondary"></router-outlet>
<lorem2>lorem2</lorem2>
<!--container-->

</app-root>
 <script src="main.js" type="module"></script>
</body></html>

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

none

This commit updates Angular SSR URL preprocessing to remove auxiliary outlet route segments before route matching. Previously, URLs containing auxiliary routes appended with outlet syntax, such as `/path(foo:bar)`, could prevent correct route resolution.

A new `stripAuxiliaryRoutes` utility function has been added to strip these segments, ensuring that SSR route matching behaves consistently with client-side routing.

This issue is similar to angular#31457, and the fix is based from angular#31476
@google-cla
Copy link

google-cla bot commented Nov 26, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@alan-agius4 alan-agius4 added the target: patch This PR is targeted for the next patch release label Nov 26, 2025
alan-agius4

This comment was marked as outdated.

@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: merge The PR is ready for merge by the caretaker labels Nov 26, 2025
@angular-robot angular-robot bot requested a review from alan-agius4 November 26, 2025 11:51
@alan-agius4
Copy link
Collaborator

alan-agius4 commented Nov 26, 2025

@JustroX, the 3rd commit starts with a double fixup!. It should only have one.

@JustroX
Copy link
Author

JustroX commented Nov 26, 2025

@JustroX, the 3rd commit starts with a double fixup!. It should only have one.

My bad. tried to fix it. Thanks @alan-agius4

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Nov 26, 2025

Hello @JustroX,

I had a quick convo with @atscott regarding auxiliary routes. He correctly mentioned that they can be positioned mid-path in the URL.

He also pointed out, that aux routes adds a lot of complexity to the URL and hence we decided that at this point we do not want to support them with SSR.

Thanks for your contribution.

@JustroX
Copy link
Author

JustroX commented Nov 26, 2025

Thanks for the review and the context. Fully understand the direction :) Happy to revisit this in the future if needed.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews area: @angular/ssr target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants