question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Server returns 404 when performing HEAD request

See original GitHub issue

OS?

macOS Sierra 10.12.3

Versions.

1.0.0-rc.0

Repro steps.

  1. 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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
filipesilvacommented, Mar 18, 2017

@exequiel09 It might be that the webpack-dev-server we use in ng 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 in dist/ after ng build. That is not a breaking change - you were just relying on a bug and we fixed that bug.

2reactions
exequiel09commented, Mar 15, 2017

@filipesilva perform a curl HEAD request. I attached screenshots of what’s happening. Performing GET request works but using HEAD request fails. I use HEAD request to check if the file is really present on the assets directory.

curl --head http://localhost:4200/assets/<path_to_file>
Head request without src before the assets folder Head request with src before the assets folder
Read more comments on GitHub >

github_iconTop Results From Across the Web

Server returns a 404 code when requesting HEAD?
Well, I'll answer myself on that one. The problem is not from NGinx but from the backend, here, PlayFramework that returns a 404...
Read more >
IIS responding with 404 on HTTP HEAD request - MSDN
It seems that Selenium sends a HEAD request to my route /Home/Index before it sends the GET request. This causes all my tests...
Read more >
Should POST request return 404 if reference to other entity fails?
I think it depends on whether the ID is in the URL or not. The URL is the address for a resource, if...
Read more >
404 Not Found Error: What It Is and How to Fix It - Airbrake Blog
Some web applications "fake" 404 Not Found Errors when requesting an invalid resource. The server returns a standard 200 OK response code, ...
Read more >
The REST API encountered an unexpected result = 404 Not ...
The requested URL was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found