-
Notifications
You must be signed in to change notification settings - Fork 8
Pre-rendered routes are not served #4
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
I've opened a bug ticket at Angular angular/angular-cli#27196 |
Hello Timothy, In our Angular projects with SSR (Server-Side Rendering), we do not implement pre-rendering. However, after reviewing how the Express server operates, I think that what you're experiencing is likely not a bug, but rather an inherent feature of SSR. Upon examining the A possible solution would be to add the URLs or the specific pattern for the pre-rendered content, directing it to the I hope this suggestion proves to be helpful. |
That’s what I’m doing as a workaround now. I manually serve them but it should be done by the Angular framework. Angular does serve these pre-rendered pages correctly if the project isn’t using i18n. It only doesn’t work as expected when adding i18n. Hence I opened the bug ticket there as well. |
By refactoring publicPath to use resolved serverDistFolder, unnecessary concatenation of language is eliminated Issue: #4
@timothyBrake after reviewing and debugging the code of CommonEngine, we have seen that in this case, Angular uses the full URL to search for the pre-rendered page. We have adjusted commonEngine
.render({
bootstrap,
documentFilePath: indexHtml,
url: `${protocol}://${headers.host}${originalUrl}`,
publicPath: resolve(serverDistFolder, `../../browser/`), // publicPath does not need to concatenate the language.
providers: [
{ provide: APP_BASE_HREF, useValue: langPath },
{ provide: LOCALE_ID, useValue: lang },
{ provide: RESPONSE, useValue: res },
{ provide: REQUEST, useValue: req },
],
}) Thank you very much for the information on pre-rendering. |
The pre-rendered routes are not served.
Most basic example:
Somewhere along the way Angular isn't serving the pre-rendered page when navigating to http://localhost:4000/en/page-1
Any ideas how to configure Angular 17 to make pre-render work out of the box (instead of manually serving these pages when they exist)?
The text was updated successfully, but these errors were encountered: