Skip to content

Instantly share code, notes, and snippets.

@armetiz
Created April 9, 2013 13:10
Show Gist options
  • Save armetiz/5345573 to your computer and use it in GitHub Desktop.
Save armetiz/5345573 to your computer and use it in GitHub Desktop.
Meteor - How to get user IP on server-side
if (Meteor.isServer) {
__meteor_bootstrap__.app.on("request", function(req, res) {
console.log(req.connection.remoteAddress);
});
}
@MohamedAlaa
Copy link

Not Working. but this one is working:

var app = __meteor_bootstrap__.app, 
    Fiber = Npm.require('fibers'),
    headers = {};

app.use(function(req, res, next) {Fiber(function () {
        console.info(req.connection.remoteAddress);
        next();
    }).run();
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment