Title: [ServiceWorker] localhost took too long to respond. HTTP ERROR 504 · Issue #21636 · angular/angular · GitHub
Open Graph Title: [ServiceWorker] localhost took too long to respond. HTTP ERROR 504 · Issue #21636 · angular/angular
X Title: [ServiceWorker] localhost took too long to respond. HTTP ERROR 504 · Issue #21636 · angular/angular
Description: I'm submitting a... [x] Bug report Minimal reproduction of the problem with instructions ng new sw --service-worker --routing cd sw ng g c home ng g c about Edit app-routing.module.ts to add the routes for the 2 components we've just cre...
Open Graph Description: I'm submitting a... [x] Bug report Minimal reproduction of the problem with instructions ng new sw --service-worker --routing cd sw ng g c home ng g c about Edit app-routing.module.ts to add the ro...
X Description: I'm submitting a... [x] Bug report Minimal reproduction of the problem with instructions ng new sw --service-worker --routing cd sw ng g c home ng g c about Edit app-routing.module.ts to add th...
Opengraph URL: https://github.com/angular/angular/issues/21636
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[ServiceWorker] localhost took too long to respond. HTTP ERROR 504","articleBody":"## I'm submitting a...\r\n```\r\n[x] Bug report\r\n```\r\n\r\n## Minimal reproduction of the problem with instructions\r\n1. `ng new sw --service-worker --routing`\r\n2. `cd sw`\r\n3. `ng g c home`\r\n4. `ng g c about`\r\n5. Edit `app-routing.module.ts` to add the routes for the 2 components we've just created:\r\n```\r\n// ...\r\nimport { HomeComponent } from './home/home.component';\r\nimport { AboutComponent } from './about/about.component';\r\n\r\nconst routes: Routes = [\r\n { path: '', component: HomeComponent },\r\n { path: 'about', component: AboutComponent }\r\n];\r\n\r\n// ...\r\n```\r\n6. `ng build --prod`\r\n7. `npm install -g http-server` (you can use any server to test this, if you already prefer another one)\r\n8. `http-server dist`\r\n9. Access `localhost:8080` (8080 is the default port that http-server uses at the time of reporting this issue)\r\n10. Access `localhost:8080/about`\r\n11. Stop the server\r\n12. Now try reloading the app while on the `/about` route (if it works the first time, try refreshing a few more times or wait a little before trying again). The browser will display the message:\r\n```\r\nThis page isn’t working\r\nlocalhost took too long to respond.\r\nHTTP ERROR 504\r\n```\r\n(With Universal/SSR, it stops working right away, most of the time with the first refresh after stopping the server, no matter the route - and the issue is not the hash in the generated ngsw.json, because I regenerate that at the end of the build process).\r\n\r\nNow, if you start the server again, loading the app on the `/about` route works (even though http-server is not SPA friendly, it doesn't redirect all requests to index.html), but the service worker kicks in.\r\nInitially I noticed this behavior on a Universal app, doing server side rendering (following the [universal-starter repo](https://github.com/angular/universal-starter)). So this is not a http-server \"not being SPA friendly\" issue.\r\nI only used http-server to reproduce it because I wanted to keep the reproduction process as fast as possible, without introducing server side rendering.\r\nThe CLI version used (1.6.4) initializes the app with Angular 5.1.0, but I've also tested on 5.2.1. I've skipped mentioning this step above because it happens regardless of the Angular version (at least on `>= 5.1.0`, haven't tested with older versions).\r\n\r\n\r\n## Environment\r\n\r\n```\r\nAngular CLI: 1.6.4\r\nNode: 8.9.4\r\nOS: win32 x64\r\nAngular: 5.2.1\r\n\r\nBrowser:\r\nI've only tested on:\r\n- [x] Chrome (desktop) version 63.0.3239.132\r\n- [x] Chrome (desktop) version 65.0.3323.2 (canary)\r\n```\r\n","author":{"url":"https://github.com/NgxDev","@type":"Person","name":"NgxDev"},"datePublished":"2018-01-18T17:07:17Z","url":"https://github.com/angular/angular/issues/21636"}
| 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:6d24b1a7-e96b-3fd7-3d20-1f6dceaf16ea |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B178:2463BD:120FA9C:1732C1F:6B010DDD |
| html-safe-nonce | 63c25ee67d61fc7b35136ca81307b1a57d6c1526a120649d7bae20c58aeaa6ec |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMTc4OjI0NjNCRDoxMjBGQTlDOjE3MzJDMUY6NkIwMTBEREQiLCJ2aXNpdG9yX2lkIjoiMjAyNzEyNTY0MzgyMDQ2OTcyNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 58b9d896e067bf99b2f784c91a4b9cc9a9c227cbb19d05096a3b9225f835f885 |
| hovercard-subject-tag | issue:289705766 |
| 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/21636/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2875e27d56ee8ea1197905332fba11ecc87e8969109b0b9916d1d3fb2485290e/angular/angular/issues/21636 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2875e27d56ee8ea1197905332fba11ecc87e8969109b0b9916d1d3fb2485290e/angular/angular/issues/21636 |
| og:image:alt | I'm submitting a... [x] Bug report Minimal reproduction of the problem with instructions ng new sw --service-worker --routing cd sw ng g c home ng g c about Edit app-routing.module.ts to add the ro... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | NgxDev |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width