You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SSR redirects a redirectTo that uses a route parameter to the literal :id instead of the parameter value #34410
Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
With server rendering, a route whose redirectTo reuses one of its own route parameters is redirected to the literal parameter name. The Angular router substitutes the matched parameter on the client:
Client-side navigation to /old/5 ends up at /new/5.
A server-rendered request for /old/5 responds 302 with Location: /new/:id.
resolveRedirectTo in packages/angular/ssr/src/routes/ng-routes.ts replaces parameters of the parent route with *, but leaves :id in the redirectTo string unchanged. buildPathWithParams in packages/angular/ssr/src/utils/url.ts then only fills * segments from the request path, so the :id placeholder is never replaced.
Minimal Reproduction
ng new repro --ssr --defaults # outputMode: server
Routes as above, serverRoutes with { path: '**', renderMode: RenderMode.Server }, then:
ng build && node dist/repro/server/server.mjs
curl -i http://localhost:4000/old/5
Exception or Error
HTTP/1.1 302 Found
Location: /new/:id
Expected `Location: /new/5`.
Activity