2016-07-05 715 views
0

我正在使用节点包http-server在本地为我的网页提供服务。突然间它开始无法连接到代理服务器。在stackoverflow中搜索,但没有得到满意的答案这种情况。请帮忙。节点http-server在使用代理时异常停止错误:连接EHOSTUNREACH

下面是命令和日志:发现问题

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)

回答

0

。我的错。代理地址必须位于引号内。不知道什么时候它被强制引用。下面是示例命令,如果有帮助任何人 -

http-server app/ -p 8000 --proxy 'http://localhost:3000'

或简单地以下(默认端口和电流DIR而不是指定的文件夹“应用”)

http-server --proxy 'http://localhost:3000'