Title: Prerendering via "routesFile" with i18n no longer prerenders index.html, produces infinite "Redirecting" loop (since @angular/ssr 20.3.7) · Issue #31877 · angular/angular-cli · GitHub
Open Graph Title: Prerendering via "routesFile" with i18n no longer prerenders index.html, produces infinite "Redirecting" loop (since @angular/ssr 20.3.7) · Issue #31877 · angular/angular-cli
X Title: Prerendering via "routesFile" with i18n no longer prerenders index.html, produces infinite "Redirecting" loop (since @angular/ssr 20.3.7) · Issue #31877 · angular/angular-cli
Description: Command build Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was 20.3.6 Description Using angular.json "prerender": { "routesFile": "...", "discoverRou...
Open Graph Description: Command build Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was 20.3.6 Description Using angular.json "prerend...
X Description: Command build Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was 20.3.6 Description Using angular.json "pr...
Opengraph URL: https://github.com/angular/angular-cli/issues/31877
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Prerendering via \"routesFile\" with i18n no longer prerenders index.html, produces infinite \"Redirecting\" loop (since @angular/ssr 20.3.7)","articleBody":"### Command\n\nbuild\n\n### Is this a regression?\n\n- [x] Yes, this behavior used to work in the previous version\n\n### The previous version in which this bug was not present was\n\n20.3.6\n\n### Description\n\nUsing `angular.json` `\"prerender\": { \"routesFile\": \"...\", \"discoverRoutes\": false }`, in combination with `\"i18n\": { ... }` and `\"localize\"`, no longer prerenders locale/index.html properly.\n\n### Minimal Reproduction\n\nFollow the following minimal reproduction steps:\n1. `ng new test-prerender-i18n --style=scss --ssr --zoneless --ai-config=none`\n2. `cd test-prerender-i18n`\n3. `ng add @angular/localize`\n4. `echo \"/\" > prerender-routes.txt`\n5. Edit `app.routes.ts`, use the following content:\n ```typescript\n import { Routes } from '@angular/router';\n import { App } from './app';\n\n export const routes: Routes = [\n { path: '', component: App }\n ];\n ```\n6. Edit `angular.json`:\n - Under `\"projects\" > \"test-prerender-i18n\"`, add:\n ```json\n \"i18n\": {\n \"sourceLocale\": \"en\"\n },\n ```\n - Under `\"configurations\" > \"production\"`, add\n ```json\n \"prerender\": {\n \"routesFile\": \"prerender-routes.txt\",\n \"discoverRoutes\": false\n },\n \"localize\": [\"en\"],\n ```\n - Remove `\"outputMode\": \"server\",` (doesn't work with prerender)\n7. Run `ng build`\n8. Try the build: `npx serve dist/test-prerender-i18n/browser/`\n then open Chrome http://localhost:3000/en => infinite redirect loop\n9. `cat dist/test-prerender-i18n/browser/en/index.html`\n You will see the following HTML with infinite Redirecting loop, instead of actual prerendered content:\n```html\n\u003c!DOCTYPE html>\n\u003chtml>\n \u003chead>\n \u003cmeta charset=\"utf-8\">\n \u003ctitle>Redirecting\u003c/title>\n \u003cmeta http-equiv=\"refresh\" content=\"0; url=/en\">\n \u003c/head>\n \u003cbody>\n \u003cpre>Redirecting to \u003ca href=\"/en\">/en\u003c/a>\u003c/pre>\n \u003c/body>\n\u003c/html>\n```\n\n\n### Exception or Error\n\n```text\nRedirecting\n```\n\n### Your Environment\n\n```text\nAngular CLI: 20.3.11\nNode: 22.16.0\nPackage Manager: npm 11.6.2\nOS: linux x64\n```\n\n### Anything else relevant?\n\n- The issue affects the root route only (\"/\") i.e., the homepage.\n Other routes (such as /blog) seem to get prerendered just fine.\n- Can reproduce only with `\"discoverRoutes\": false`\n\n### Regression 20.3.6 -> 20.3.7\n- Try version `20.3.6` of `@angular/ssr` => Prerendering works.\n `npm i @angular/ssr@20.3.6 && ng build && cat dist/test-prerender-i18n/browser/en/index.html`\n- Try version `20.3.7` of `@angular/ssr` => Redirecting...\n `npm i @angular/ssr@20.3.7 && ng build && cat dist/test-prerender-i18n/browser/en/index.html`\n\n### Culprit\n- https://github.com/angular/angular-cli/releases/tag/20.3.7 → Might be caused by https://github.com/angular/angular-cli/commit/5db6d64870c7ce0b883722a07c828946b7d2217d\n- Also related: https://github.com/angular/angular-cli/issues/31618\n (A different issue also since `20.3.7` about missing `index.html` in some cases; no mention of i18n.)\n- Note: The issue also reproduces with the upcoming version `21.0.0`:\n `ng update @angular/core@next @angular/cli@next`\n `ng build && cat dist/test-prerender-i18n/browser/en/index.html` => Same issue.","author":{"url":"https://github.com/anisabboud","@type":"Person","name":"anisabboud"},"datePublished":"2025-11-19T19:34:47Z","url":"https://github.com/angular/angular-cli/issues/31877"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:94aa60f0-286a-041a-6479-ce15dd4f5007 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BFD0:3F22BC:62745:8C68E:6AFDD65C |
| html-safe-nonce | 4e336506bebe9166c26adf5f013450b9ed137bbc1094ef7cf82d770d5dcce921 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRkQwOjNGMjJCQzo2Mjc0NTo4QzY4RTo2QUZERDY1QyIsInZpc2l0b3JfaWQiOiIzNzUzODE3NTQxODA2MjQ5NTY0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a89a9ac2b211b4fe937367fc7bd0df25a64dfaba95f930a5d3a378f4eb79796f |
| hovercard-subject-tag | issue:3644153263 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/31877/issue_layout |
| twitter:image | https://opengraph.githubassets.com/165370252912503c2a3e6b0a297bcb9de1b506233568742b23fe585374fe5ae3/angular/angular-cli/issues/31877 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/165370252912503c2a3e6b0a297bcb9de1b506233568742b23fe585374fe5ae3/angular/angular-cli/issues/31877 |
| og:image:alt | Command build Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was 20.3.6 Description Using angular.json "prerend... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | anisabboud |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9918bd4004419458bcd838065ac2a76b76ebd11705d73909fff5ab99e996fa23 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a231c174493a6a442c0b0544475c918b30128208 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width