-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AngularNodeAppEngine
has different unknown path routing behavior than CommonEngine
#29539
Comments
…t ones Ensures that the SSR router gives precedence to the first matching route, addressing the issue where later conflicting routes. This change prevents the incorrect prioritization of routes and ensures the intended route is matched first, aligning routing behavior. Closes: angular#29539
There seems to be a misalignment here, which we should address by prioritizing the first matched route. The issue appears to be related to your Angular routing configuration. I'm wondering if the Angular router should raise an error or at least a warning when there are conflicting routes like this. The catch-all route ( This leads to the following configuration: [
{
path: 'not-found',
component: NotFoundComponent
},
{
path: '**',
component: TestComponent
},
{
path: '**',
redirectTo: 'not-found'
},
]; There might be a situation where there is more than one [
{
path: 'one',
component: NotFoundComponent,
},
{
path: '**',
component: TestComponent,
canMatch: [() => false]
},
{
path: '**',
component: NotFoundComponent,
}
]; |
@alan-agius4 yes I forgot to note that in our actual routing config, we have multiple nested wildcard routes with [
{
path: '',
children: [
{
path: 'not-found',
component: NotFoundComponent
},
{
canMatch: [isSpecialRouteKind1],
path: '**',
component: TestComponent
},
{
canMatch: [isSpecialRouteKind2],
path: '**',
component: TestComponent
},
]
},
{
path: '**',
redirectTo: 'not-found'
},
] |
Oh and [
{
path: '',
children: [
{
path: '**',
component: TestComponent
},
]
},
{
path: '**',
component: NotFoundComponent
},
]
|
Just my two cents — when using SSR, I'd be cautious with This happens because the server doesn't differentiate between requests for an angular page and static files. |
1 similar comment
Just my two cents — when using SSR, I'd be cautious with This happens because the server doesn't differentiate between requests for an angular page and static files. |
We handle this in our |
…t ones Ensures that the SSR router gives precedence to the first matching route, addressing the issue where later conflicting routes. This change prevents the incorrect prioritization of routes and ensures the intended route is matched first, aligning routing behavior. Closes: #29539
…t ones Ensures that the SSR router gives precedence to the first matching route, addressing the issue where later conflicting routes. This change prevents the incorrect prioritization of routes and ensures the intended route is matched first, aligning routing behavior. Closes: #29539 (cherry picked from commit 6448f80)
Command
serve
Is this a regression?
The previous version in which this bug was not present was
18
Description
When the routing configuration contains a nested wildcard route and a redirect target and an non-nested wildcard route after the nested route that redirects to the nested route (see below),
CommonEngine
will use the nested route whileAngularNodeAppEngine
will use the non-nested route.Is this intended behavior? It seems that the vite dev server follows the behavior of
AngularNodeAppEngine
and is blocking us from upgrading to v19.Something odd is that
AngularNodeAppEngine
will render/
astest
but/asdfasdf
as404 not found
.CommonEngine
renderstest
for both of these paths.Some debugging found that
angular-cli/packages/angular/ssr/src/routes/ng-routes.ts
Line 606 in 249f9dc
angular-cli/packages/angular/ssr/src/routes/ng-routes.ts
Line 722 in 249f9dc
Minimal Reproduction
AngularNodeAppEngine
- https://github.com/griest024/ng19-server-routingCommonEngine
- https://github.com/griest024/ng19-server-routing/tree/common-enginenpx ng b && npm run serve:ssr:19-dev-server-routes
/asdfasdfasdf
or any other route that is not/
or/not-found
Exception or Error
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: