对不起,我是Redbird的新手。我正在尝试创建一个代理,以从example.com(从字面上看)连接到localhost。这是我写得不好的代码:
var proxy = require('redbird')({port: 80})
proxy.register("example.com", "http://127.0.0.1:80");
有人知道为什么127.0.0.1不能指向example.com吗?这些是一些日志:
{"name":"redbird","hostname":"NEERON","pid":14684,"level":30,"msg":"Started a Redbird reverse proxy server on port 80","time":"2019-08-21T12:21:50.257Z","v":0}
{"name":"redbird","hostname":"NEERON","pid":14684,"level":30,"from":{"protocol":"http:","slashes":true,"auth":null,"host":"example.com","port":null,"hostname":"example.com","hash":null,"search":null,"query":null,"pathname":"/","path":"/","href":"http://example.com/"},"to":{"protocol":"http:","slashes":true,"auth":null,"host":"127.0.0.1:80","port":"80","hostname":"127.0.0.1","hash":null,"search":null,"query":null,"pathname":"/","path":"/","href":"http://127.0.0.1:80/","useTargetHostHeader":false},"msg":"Registered a new route","time":"2019-08-21T12:21:50.263Z","v":0}
谢谢!
编辑:连接到127.0.0.1时显示的消息是
未找到
。