带有 localhost:3000 的 http-server 给出 ERR_INVALID_REDIRECT [英] http-server with localhost:3000 gives ERR_INVALID_REDIRECT
问题描述
我已经使用以下命令安装了 http-server:
I have installed http-server using the following command:
npm i -g http-server
在运行服务器时,我得到的响应是 Running on 127.0.0.1:8080
Upon running the server I get the response saying Running on 127.0.0.1:8080
我的电话是这样的:
http-server -a 0.0.0.0 -c-1
如果我转到 127.0.0.1:8080
或 10.1.1.72:8080
我得到:
If I go to 127.0.0.1:8080
or 10.1.1.72:8080
I get:
此页面无效.
127.0.0.1:8080 发送无效响应
ERR_INVALID_REDIRECT
我在谷歌上搜索并到处搜索,但没有真正解决这个问题的答案.我没有使用 XAMPP 或 IIS,只是一个空白的节点服务器.
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
操作系统:Windows 10
我已经检查了我的主机文件.没有什么相关的.我不知道是什么导致了这种情况.我也不使用 .htaccess 文件或 Web.config 文件.
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.
注意事项
如果我转到 localhost:8080/index.html
我可以访问我的应用程序.但这不应该像那样工作.
If I go to localhost:8080/index.html
I can get to my app. This isn't supposed to work like that though.
推荐答案
尝试降级 http-server 版本,因为最新版本(0.10.0 和 0.11.0)由于欣喜若狂(3.3.2)导致问题.
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).
尝试卸载当前的 http-server 版本,然后尝试安装 0.9.0 或更旧的版本
Try uninstalling the current http-server version and then try to install 0.9.0 or older version
卸载
npm uninstall -g http-server
安装
npm install http-server@0.9.0
这篇关于带有 localhost:3000 的 http-server 给出 ERR_INVALID_REDIRECT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!