Title: Options to disable WebDevServer's historyApiFallback · Issue #9640 · angular/angular-cli · GitHub
Open Graph Title: Options to disable WebDevServer's historyApiFallback · Issue #9640 · angular/angular-cli
X Title: Options to disable WebDevServer's historyApiFallback · Issue #9640 · angular/angular-cli
Description: Currently, ng serve will serve up the index page whenever an HTTP 404 error would otherwise occur. There are several instances where this is problematic: You've configured the router to use URL fragments (aka "#" hash) and want local dev...
Open Graph Description: Currently, ng serve will serve up the index page whenever an HTTP 404 error would otherwise occur. There are several instances where this is problematic: You've configured the router to use URL fra...
X Description: Currently, ng serve will serve up the index page whenever an HTTP 404 error would otherwise occur. There are several instances where this is problematic: You've configured the router to use URL...
Opengraph URL: https://github.com/angular/angular-cli/issues/9640
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Options to disable WebDevServer's historyApiFallback","articleBody":"Currently, `ng serve` will serve up the index page whenever an HTTP 404 error would otherwise occur. There are several instances where this is problematic:\r\n* You've configured the router to use URL fragments (aka \"#\" hash) and want local development server to mirror production usage -- so that \"works on my machine\" isn't as possible\r\n* You're trying to serve a new file and you're not sure if it's being bundled/output/copied successfully. It's frustrating when you try to browse around to find the new file and get index.html contents instead\r\n\r\n### Repro steps\r\n* Configure your angular app's router to use URL fragments (aka hash, \"#\")\r\n* Possibly make changes to `.angular-cli.json`\r\n* Open http://localhost:4200/page-that-does-not-exist.html\r\n\r\n### Observed behavior\r\n* http://localhost:4200/page-that-does-not-exist.html will serve up the app's index page\r\n\r\n### Desired behavior\r\n* I want those 404 Not Found's!\r\n\r\n### Notes\r\nWhile it would be *fantastic* if the cli could inspect the app to determine that the router was configured with [`{ useHash: true}`](https://angular.io/api/router/ExtraOptions#members), I'd also be willing to accept a command-line parameter or some new option in `.angular-cli.json`.\r\n\r\nThe 404-handling is using WebpackDevServer's [.historyApiFallback option](https://webpack.js.org/configuration/dev-server/#devserver-historyapifallback).\r\n\r\nSee also: [./packages/@angular/cli/tasks/serve.ts](https://github.com/angular/angular-cli/blob/a40e801a954fd4b79e8f042f9e1692971feadf9e/packages/%40angular/cli/tasks/serve.ts#L214)","author":{"url":"https://github.com/eib","@type":"Person","name":"eib"},"datePublished":"2018-02-15T20:50:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/9640/angular-cli/issues/9640"}
| 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:f6c0953b-bd01-5d52-9308-f2689de9552b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 922E:275F62:2EC8F73:40293DA:6972B47A |
| html-safe-nonce | 239b575808c491d89ad478ee0013459471c42b87f2df37edc5c0322bddb0f430 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MjJFOjI3NUY2MjoyRUM4RjczOjQwMjkzREE6Njk3MkI0N0EiLCJ2aXNpdG9yX2lkIjoiNzE3OTgzODU0Nzc4NjExODI2NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 556cb368504dfb6323e9b41a1ae2efa747589665d26971b1bbc91af96ce65c93 |
| hovercard-subject-tag | issue:297591969 |
| 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/9640/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cfac57ce4d9e2a7d0bd4a3b351be7a8ec1a9620fb1399a53cd8bf2f1f274cbcc/angular/angular-cli/issues/9640 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cfac57ce4d9e2a7d0bd4a3b351be7a8ec1a9620fb1399a53cd8bf2f1f274cbcc/angular/angular-cli/issues/9640 |
| og:image:alt | Currently, ng serve will serve up the index page whenever an HTTP 404 error would otherwise occur. There are several instances where this is problematic: You've configured the router to use URL fra... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | eib |
| hostname | github.com |
| expected-hostname | github.com |
| None | 51c0d0848f5569c6fa2198e9d69bd5f8f94a83c9fa3659e40728e7732afab130 |
| 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 | 10c5e2f2307495b2750073db87e9a5d3356a924f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width