将子域反向代理到同一台机器上的不同端口会抛出 404

Reverse proxying subdomains to different ports on the same machine throws 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:3000http://36.154.99.115:3001http://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...

Note: I tried proxy.register("http://www.example.com", "http://www.facebook.com") and it worked.

Diet.js 似乎是这里的问题,尝试将 web-server 移植到 Express.js.

或者,尝试使用 Express.js 或相对通用的东西创建示例应用程序,然后尝试重定向到它。如果可行(希望可行),您知道该怎么做。