-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Labels
area: @angular-devkit/build-angularfeatureIssue that requests a new featureIssue that requests a new feature
Milestone
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 development server to mirror production usage -- so that "works on my machine" isn't as possible
- 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
Repro steps
- Configure your angular app's router to use URL fragments (aka hash, "#")
- Possibly make changes to
.angular-cli.json - Open http://localhost:4200/page-that-does-not-exist.html
Observed behavior
- http://localhost:4200/page-that-does-not-exist.html will serve up the app's index page
Desired behavior
- I want those 404 Not Found's!
Notes
While it would be fantastic if the cli could inspect the app to determine that the router was configured with { useHash: true}, I'd also be willing to accept a command-line parameter or some new option in .angular-cli.json.
The 404-handling is using WebpackDevServer's .historyApiFallback option.
See also: ./packages/@angular/cli/tasks/serve.ts
Lyrencropt, eib, oliverguenther, dev-tsc, drdamour and 1 more
Metadata
Metadata
Assignees
Labels
area: @angular-devkit/build-angularfeatureIssue that requests a new featureIssue that requests a new feature