Need private packages and team management tools?Check out npm Teams »

req-ip

1.1.0 • Public • Published

req-ip Build Status

Middleware for appending req.ip to HTTP requests with support for reverse proxies

Install

$ npm install --save req-ip

Usage

var ReqIp = require('req-ip')
var reqIp = ReqIp()
 
reqIp(req, res, function (err) {
  //=> req.ip === '1.2.3.4'  
})

API

ReqIp(header) -> function

Returns a middleware function that applies req.ip and then calls back.

header

Type: string
Default: 'x-forwarded-for'

A header name to use to set the IP address. When no matching header is found, req.connection.remoteAddress is used instead.

License

MIT © Ben Drucker

Install

npm i req-ip

DownloadsWeekly Downloads

23

Version

1.1.0

License

MIT

Unpacked Size

4.42 kB

Total Files

5

Last publish

Collaborators

  • avatar