http-proxy模块中的错误:必须提供一个合适的URL作为目标
我是Node.JS
新Node.JS
并在VPS上部署了第一个应用程序。 在8000
端口上运行后,我决定创build一个http-proxy
来将每个域转发到其特定的端口。 我喜欢这里的一个小应用程序:
var http = require('http'), httpProxy = require('http-proxy'); var option = { router : { 'domain.com' : 'http://88.198.86.100:8000' } }; var proxyServer = httpProxy.createServer(option); proxyServer.listen(80);
88.198.86.100 is my server ip
。
所以,我的问题在这里显示,当我在我的浏览器电脑(谷歌浏览器)键入88.198.86.100
,我的代理服务器应用程序被抛弃,并给出了这个错误:
C:\Users\Administrator\Desktop\Nodejs\node_modules\http-proxy\lib\http-proxy\index.js:119 throw err; ^ Error: Must provide a proper URL as target at ProxyServer.<anonymous> (C:\Users\Administrator\Desktop\Nodejs\node_modules\http-proxy\lib\http-proxy\index.js:68:35) at Server.closure (C:\Users\Administrator\Desktop\Nodejs\node_modules\http-proxy\lib\http-proxy\index.js:125:43) at emitTwo (events.js:106:13) at Server.emit (events.js:191:7) at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:546:12) at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23) error: Forever detected script exited with code: 1
我想要有人在每个浏览器中inputIP服务器,我的应用程序不会崩溃。