angular-cli: Server returns 404 when performing HEAD request
OS?
macOS Sierra 10.12.3
Versions.
1.0.0-rc.0
Repro steps.
- Perform HEAD request to the spawned server by
ng serve
using (cURL, fetch, Angular HTTP, XHR) and it will automatically return 404.
Mention any other details that might be useful.
When the URL provided is: http://localhost:4200/assets/img/ui/logo.png (assuming it exists) it returns 404. But when the URL provided is: http://localhost:4200/src/assets/img/ui/logo.png it returns 200.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 15 (4 by maintainers)
@exequiel09 It might be that the
webpack-dev-server
we use inng serve
does not support HEAD requests as configured. If that’s an option we can include it.@Daedalon the change I mentioned prevented files that were not in a build from being served from
ng serve
. Files that are on disk but are not included in a build should not be served because they are not part of the files that go indist/
afterng build
. That is not a breaking change - you were just relying on a bug and we fixed that bug.@filipesilva perform a curl
HEAD
request. I attached screenshots of what’s happening. PerformingGET
request works but usingHEAD
request fails. I useHEAD
request to check if the file is really present on theassets
directory.@filipesilva Could you clarify what you mean? The URLs for assets are broken due to this change and unfortunately I didn’t yet understand what your sentence means in this context.
The alternatives I see are: