Http-server: 404 is "Not Found"

Created on 28 Sep 2016  路  9Comments  路  Source: http-party/http-server

When I start a http-server.Browser will queried "Failed to load resource: the server responded with a status of 404 (Not Found)". What's it? How can I solve?

Most helpful comment

http-server doesn't allow and, by the HTTP specs, cannot deliver files outside the web root. You should either let http-server serve the directory above or symlink it into the web root using ln -s.

All 9 comments

Which files are in the directory you ran http-server in? What URL did you type in your browser?

Bumping this because I am suddenly having the same issue. I can't load any of my includes from a relative path. I'm getting 404 errors in the console, but only when running in http-server, not off the file system.

e.g. ../bower_components/angular/angular.min.js
All my production dependencies are up one dir from my index.html (I don't want 3rd party code in my app directory).

The Chrome console is showing all include requests as being located in a child directory, but only when running in http-server: localhost:8080/bower_components/etc.

http-server doesn't allow and, by the HTTP specs, cannot deliver files outside the web root. You should either let http-server serve the directory above or symlink it into the web root using ln -s.

@derhuerst Thanks much, makes perfect sense.

Would you mind closing the issue to reduce cognitive load for the maintainer? Thanks!

closes #315

Didn't see that @weirdoCHAO opened the issue. @weirdoCHAO please close this.

House cleaning.

Was this page helpful?
0 / 5 - 0 ratings