多个子域名连接到流星应用程序

Multiple subdomains connected to meteor app

本文关键字:流星 应用程序 连接 域名      更新时间:2023-09-26

许多子域被转发到我的流星应用程序工作的子域X。

我正在使用不工作的代码:

WebApp.connectHandlers.use(function(req, res, next) {
    console.log(req.connection.domain); // is null 
    console.log(req.server.domain); // is null
    next();
});

试图在服务器上使用IronRouter:

Router.map(function () {
    this.route('testRoute', {
        where: 'server',
        path: '*',
        action: function () {
            console.log(this.request.connection.domain);  // null
        }
    });
});

我知道FastRender注入头,它的工作,但问题是:

如何获取用户使用WebApp访问流星应用程序的子域?

在第一个示例中,也将req.headers记录到控制台。其中一个字符串应该包含原始请求域。但是,这可能取决于您的代理是如何配置的。