{"action":"created","issue":{"url":"https://api.github.com/repos/feathersjs/feathers/issues/324","repository_url":"https://api.github.com/repos/feathersjs/feathers","labels_url":"https://api.github.com/repos/feathersjs/feathers/issues/324/labels{/name}","comments_url":"https://api.github.com/repos/feathersjs/feathers/issues/324/comments","events_url":"https://api.github.com/repos/feathersjs/feathers/issues/324/events","html_url":"https://github.com/feathersjs/feathers/issues/324","id":153166744,"number":324,"title":"Accessing remote_address in before hook from REST provider","user":{"login":"patrickpereira","id":10369669,"avatar_url":"https://avatars.githubusercontent.com/u/10369669?v=3","gravatar_id":"","url":"https://api.github.com/users/patrickpereira","html_url":"https://github.com/patrickpereira","followers_url":"https://api.github.com/users/patrickpereira/followers","following_url":"https://api.github.com/users/patrickpereira/following{/other_user}","gists_url":"https://api.github.com/users/patrickpereira/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickpereira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickpereira/subscriptions","organizations_url":"https://api.github.com/users/patrickpereira/orgs","repos_url":"https://api.github.com/users/patrickpereira/repos","events_url":"https://api.github.com/users/patrickpereira/events{/privacy}","received_events_url":"https://api.github.com/users/patrickpereira/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-05T04:39:33Z","updated_at":"2016-05-05T04:51:29Z","closed_at":null,"body":"Hi feathers,\r\n\r\nIs it possible to access the remote_address in the before hook and if so, how is it done?\r\n\r\nBest regards\r\nPatrick"},"comment":{"url":"https://api.github.com/repos/feathersjs/feathers/issues/comments/217076338","html_url":"https://github.com/feathersjs/feathers/issues/324#issuecomment-217076338","issue_url":"https://api.github.com/repos/feathersjs/feathers/issues/324","id":217076338,"user":{"login":"daffl","id":338316,"avatar_url":"https://avatars.githubusercontent.com/u/338316?v=3","gravatar_id":"","url":"https://api.github.com/users/daffl","html_url":"https://github.com/daffl","followers_url":"https://api.github.com/users/daffl/followers","following_url":"https://api.github.com/users/daffl/following{/other_user}","gists_url":"https://api.github.com/users/daffl/gists{/gist_id}","starred_url":"https://api.github.com/users/daffl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daffl/subscriptions","organizations_url":"https://api.github.com/users/daffl/orgs","repos_url":"https://api.github.com/users/daffl/repos","events_url":"https://api.github.com/users/daffl/events{/privacy}","received_events_url":"https://api.github.com/users/daffl/received_events","type":"User","site_admin":false},"created_at":"2016-05-05T04:51:29Z","updated_at":"2016-05-05T04:51:29Z","body":"You can [add a middleware](http://docs.feathersjs.com/rest/readme.html#query-route-and-middleware-parameters) and set the `req.feathers` object with that information:\r\n\r\n```js\r\napp.use(function(req, res, next) {\r\n  req.feathers.ip = req.ip;\r\n});\r\n```\r\n\r\nNow it will be available for every REST call in the service parameters as `params.ip`. For websocket connections you will have to do the [same thing in a Socket.io middleware](http://docs.feathersjs.com/real-time/socket-io.html#configuration)."}}