Edit Page

req.ip

The IP address of the client who sent this request (req).

Note:

If your Sails app is deployed behind a proxy (on Heroku, for example), then you'll need to do a bit of additional configuration. Normally, req.ip is simply the "remote address"—the IP address of the requesting user agent. But if the sails.config.http.trustProxy option is enabled, this is the "upstream address".

Usage

#
req.ip;

Example

#
req.ip;
// -> "127.0.0.1"

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.

Reference

Reference