Tag: 饮食

反向代理子域到同一台机器上的不同端口将引发404

我尝试过像红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: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") ,它工作。