I have installed http-server using the following command:
npm i -g http-server
Upon running the server I get the response saying Running on 127.0.0.1:8080
My call looks like this:
http-server -a 0.0.0.0 -c-1
If I go to 127.0.0.1:8080
or 10.1.1.72:8080
I get:
This page is not working.
127.0.0.1:8080 sent an invalid response
ERR_INVALID_REDIRECT
I have googled and searched everywhere with no answer as to what actually solves this. I'm not using XAMPP or IIS just a blank node server.
Node.js: 11.12.0
npm: 6.7.0
OS: Windows 10
I have checked my host files, there is nothing relevant there. I have no idea what would be causing this. I don't use .htaccess files or Web.config files either.
Notes
If I go to localhost:8080/index.html
I can get to my app. This isn't supposed to work like that though.
Try downgrading the http-server version as the latest version (0.10.0 and 0.11.0) is causing issue due to ecstatic (3.3.2).
Try uninstalling the current http-server version and then try to install 0.9.0 or older version
Uninstall
npm uninstall -g http-server
Install
npm install [email protected]
This is still an open issue with http-server, which is supposedly caused by the latest version of one http-server's dependencies called ecstatic:
https://github.com/http-party/http-server/issues/525
There are three workarounds for this at the point:
Point the browser to localhost:8080/index.html instead of just http://localhost:8080.
Downgrade your http-server version to 0.9 from 10.0
npm uninstall -g http-server
npm install [email protected]
Open package.json file under the http-server module and downgrade ecstatic dependency
to 3.3.1 (found under 'dependencies' key).
I'm having the exact same problem. Just installed both node and http-server globally. run http-server
and it gives me the following error when accessing localhost:8080:
"ERR_INVALID_REDIRECT"
If I try to access the index.html page
, it works. It doesn't even show directories listing, even with -d
in the command line.
I got something, though: installing an older version of http-server
and it loads the index.html
automagically :)
This was the command/version: npm install -g [email protected]
Anything newer (0.9.0+) and it breaks again.
Edit:
Even then, it will only work on sub-folders, not on the root. For example:
http://localhost:8080/mypage/ will load index.html automatically.
http://localhost:8080/ won't
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With