meteor301redirectnodejs

我如何使用meteor301将www.site.comredirect到site.com。

我通常使用快递,但我们没有meteor

如果你看看packages / accounts-oauth-helper / oauth_server.js,你会发现一个如何让服务器在HTTP上侦听的例子:

 // Listen to incoming OAuth http requests __meteor_bootstrap__.app .use(connect.query()) .use(function(req, res, next) { // Need to create a Fiber since we're using synchronous http // calls and nothing else is wrapping this in a fiber // automatically Fiber(function () { Accounts.oauth._middleware(req, res, next); }).run(); }); 

您可以检查req.url并使用req.url设置HTTP标头并调用res.end() ,或使用next()继续进入通常的Meteor堆栈,而不是使用Fibre并调用OAuth中间件逻辑。