【发布时间】:2017-02-12 08:22:34
【问题描述】:
我尝试过redbird 喜欢:
var proxy = require('redbird')({port: 80});
proxy.register("http://www.example.com", "http://36.154.99.115:3000");
proxy.register("http://abc.example.com", "http://36.154.99.115:3001");
proxy.register("http://xyz.example.com", "http://36.154.99.115:3002");
和redwire 喜欢:
var RedWire = require('redwire');
proxy = new RedWire({http: { port: 80 }});
proxy.http("http://www.example.com", "http://36.154.99.115:3000");
proxy.http("http://abc.example.com", "http://36.154.99.115:3001");
proxy.http("http://xyz.example.com", "http://36.154.99.115:3002");
我可以点击http://36.154.99.115:3000、http://36.154.99.115:3001 和http://36.154.99.115:3003 来成功加载相应的网页,但是当我尝试点击http://www.example.com 时,我得到的只是404 host not found。
我在控制台上收到以下日志:
{"name":"redbird","hostname":"ip-172-31-23-160","pid":3239,"level":30,"msg":"Proxying www.example.com/ to www.example.com:3000/","time":"2017-02-12T08:07:57.540Z","v":0}
看似成功,其实行不通……
运行在 3000、3001 和 3002 上的服务器正在使用 DietJS,如果这很重要的话...
注意:我试过
proxy.register("http://www.example.com", "http://www.facebook.com"),它成功了。
【问题讨论】:
标签: node.js reverse-proxy diet-js redbird redwire