Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

node.js - http-server with localhost:3000 gives ERR_INVALID_REDIRECT

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.

If you need further information let me know.

Notes

If I go to localhost:8080/index.html I can get to my app. This isn't supposed to work like that though.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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]

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...