-
Notifications
You must be signed in to change notification settings - Fork 12k
Angular with zoneless and SSR - redirectTo issue #29988
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
Comments
The issue is coming from the customization of the See: https://developer.mozilla.org/en-US/docs/Web/API/Response |
@alan-agius4 Thank you very mutch. I updated the server.ts and now it works for me. Whats with having CSP in the server.ts by default? It is such an important topic. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
Yes
Description
Problem Description
When configuring a redirect route in an Angular 19 application using Server-Side Rendering (SSR) and zoneless mode, an issue arises when accessing the app through the entry (root) route. In this scenario, the server returns an empty response, but the application works fine for other routes. The issue only occurs when navigating to the redirect route defined in the app.routes.ts configuration.
Steps to Reproduce:
Clone repo and install npm packages.
Configure a redirect route in app.routes.ts. (i found a working solution with a redirectGuard, you can switch)
Start the application in SSR mode. (ng serve --no-hmr)
Access the application via the entry route (root).
The server returns a blank response instead of properly redirecting.
Navigation to other routes works as expected.
Expected Behavior:
The server should correctly handle the redirect and return the appropriate content or redirect response when accessing the redirect route.
Actual Behavior:
The server returns a blank or empty response when navigating to the redirect route from the entry point. Other routes function as expected.
Please provide a link to a minimal reproduction of the bug
https://github.com/zedL-io/ng-19-zoneless-ssr-redirect-issue
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
I found a working solution for me with a route guard.
// { path: '', canActivate: [redirectGuard], children: [] }, // this work!
Comment out the redirect route and use this one to get it to work.
The text was updated successfully, but these errors were encountered: