【问题标题】:Reverse proxying subdomains to different ports on the same machine throws 404将子域反向代理到同一台机器上的不同端口会抛出 404
【发布时间】: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: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,如果这很重要的话...

注意:我试过proxy.register("http://www.example.com", "http://www.facebook.com"),它成功了。

【问题讨论】:

    标签: node.js reverse-proxy diet-js redbird redwire


    【解决方案1】:

    Diet.js 似乎是这里的问题,尝试将网络服务器移植到 Express.js

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

    【讨论】:

      猜你喜欢
      • 2012-07-09
      • 2020-02-28
      • 2020-12-29
      • 1970-01-01
      • 1970-01-01
      • 2020-01-20
      • 1970-01-01
      • 2015-03-15
      • 1970-01-01
      相关资源
      最近更新 更多