node http-server stops with exception when using proxy Error: connect EHOSTUNREACH
node http-server stops with exception when using proxy Error: connect EHOSTUNREACH
我正在使用节点包 http-server 在本地提供我的网页。突然它开始无法连接到代理服务器。在 Whosebug 中搜索但没有得到对这种情况的满意答案。请帮忙。
以下是命令和日志:
http-server -p 8000 app/ --proxy localhost:3000
Starting up http-server, serving app/
Available on:
http:127.0.0.1:8000
http:192.168.1.6:8000
Unhandled requests will be served from: localhost:3000
Hit CTRL-C to stop the server
[Mon, 04 Jul 2016 13:29:27 GMT] "POST /candidates/resumes"
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
/Users/tushar/.node_modules_global/lib/node_modules/http-server/node_modules/http-proxy/lib/http-proxy/index.js:119
throw err;
^
Error: connect EHOSTUNREACH 0.0.11.184:80 - Local (192.168.1.6:58636)
at Object.exports._errnoException (util.js:870:11)
at exports._exceptionWithHostPort (util.js:893:20)
at connect (net.js:843:14)
at net.js:985:7
at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:63:16)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:82:10)
发现问题。我的错。代理地址必须在引号内。不知道什么时候必须引用它。这是示例命令,如果它可以帮助任何人 -
http-server app/ -p 8000 --proxy 'http://localhost:3000'
或者只是以下内容(默认端口和当前目录而不是指定文件夹 'app')
http-server --proxy 'http://localhost:3000'
我正在使用节点包 http-server 在本地提供我的网页。突然它开始无法连接到代理服务器。在 Whosebug 中搜索但没有得到对这种情况的满意答案。请帮忙。
以下是命令和日志:
http-server -p 8000 app/ --proxy localhost:3000 Starting up http-server, serving app/ Available on: http:127.0.0.1:8000 http:192.168.1.6:8000 Unhandled requests will be served from: localhost:3000 Hit CTRL-C to stop the server
[Mon, 04 Jul 2016 13:29:27 GMT] "POST /candidates/resumes" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" /Users/tushar/.node_modules_global/lib/node_modules/http-server/node_modules/http-proxy/lib/http-proxy/index.js:119 throw err; ^
Error: connect EHOSTUNREACH 0.0.11.184:80 - Local (192.168.1.6:58636) at Object.exports._errnoException (util.js:870:11) at exports._exceptionWithHostPort (util.js:893:20) at connect (net.js:843:14) at net.js:985:7 at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:63:16) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:82:10)
发现问题。我的错。代理地址必须在引号内。不知道什么时候必须引用它。这是示例命令,如果它可以帮助任何人 -
http-server app/ -p 8000 --proxy
'http://localhost:3000'
或者只是以下内容(默认端口和当前目录而不是指定文件夹 'app')
http-server --proxy
'http://localhost:3000'