http-server icon indicating copy to clipboard operation
http-server copied to clipboard

404 is "Not Found"

Open weirdoCHAO opened this issue 10 years ago • 9 comments

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?

weirdoCHAO avatar Sep 28 '16 14:09 weirdoCHAO

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

derhuerst avatar Oct 06 '16 17:10 derhuerst

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.

JodyJSmith avatar Feb 07 '17 18:02 JodyJSmith

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 avatar Feb 07 '17 19:02 derhuerst

@derhuerst Thanks much, makes perfect sense.

JodyJSmith avatar Feb 07 '17 19:02 JodyJSmith

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

derhuerst avatar Feb 07 '17 19:02 derhuerst

closes #315

JodyJSmith avatar Feb 07 '17 20:02 JodyJSmith

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

derhuerst avatar Feb 07 '17 21:02 derhuerst

House cleaning.

BigBlueHat avatar Feb 22 '18 14:02 BigBlueHat

I use https://www.npmjs.com/package/live-server

SkutinAnton avatar Mar 07 '19 14:03 SkutinAnton