我在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"),它成功了。
发布于 2017-02-12 11:48:45
Diet.js似乎是这里的问题,请尝试将web服务器移植到Express.js上。
或者,尝试用Express.js或一些相对通用的东西创建一个示例应用程序,然后尝试重定向到它。如果这有效(希望如此),你就知道该怎么做了。
https://stackoverflow.com/questions/42185564
复制相似问题