Gathering detailed insights and metrics for proxy-addr
Gathering detailed insights and metrics for proxy-addr
Gathering detailed insights and metrics for proxy-addr
Gathering detailed insights and metrics for proxy-addr
npm install proxy-addr
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.2
Supply Chain
99
Quality
78.3
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
7,048,095,332
Last Day
2,064,415
Last Week
33,409,849
Last Month
147,185,338
Last Year
1,513,478,101
MIT License
136 Stars
314 Commits
27 Forks
12 Watchers
4 Branches
25 Contributors
Updated on Jun 15, 2025
Minified
Minified + Gzipped
Latest Version
2.0.7
Package Id
proxy-addr@2.0.7
Size
5.37 kB
NPM Version
6.14.10
Node Version
14.15.4
Published on
Jun 01, 2021
Cumulative downloads
Total Downloads
Last Day
-4.2%
2,064,415
Compared to previous day
Last Week
-7.6%
33,409,849
Compared to previous week
Last Month
8.8%
147,185,338
Compared to previous month
Last Year
11.6%
1,513,478,101
Compared to previous year
Determine address of proxied request
This is a Node.js module available through the
npm registry. Installation is done using the
npm install
command:
1$ npm install proxy-addr
1var proxyaddr = require('proxy-addr')
Return the address of the request, using the given trust
parameter.
The trust
argument is a function that returns true
if you trust
the address, false
if you don't. The closest untrusted address is
returned.
1proxyaddr(req, function (addr) { return addr === '127.0.0.1' }) 2proxyaddr(req, function (addr, i) { return i < 1 })
The trust
arugment may also be a single IP address string or an
array of trusted addresses, as plain IP addresses, CIDR-formatted
strings, or IP/netmask strings.
1proxyaddr(req, '127.0.0.1') 2proxyaddr(req, ['127.0.0.0/8', '10.0.0.0/8']) 3proxyaddr(req, ['127.0.0.0/255.0.0.0', '192.168.0.0/255.255.0.0'])
This module also supports IPv6. Your IPv6 addresses will be normalized
automatically (i.e. fe80::00ed:1
equals fe80:0:0:0:0:0:ed:1
).
1proxyaddr(req, '::1') 2proxyaddr(req, ['::1/128', 'fe80::/10'])
This module will automatically work with IPv4-mapped IPv6 addresses
as well to support node.js in IPv6-only mode. This means that you do
not have to specify both ::ffff:a00:1
and 10.0.0.1
.
As a convenience, this module also takes certain pre-defined names in addition to IP addresses, which expand into IP addresses:
1proxyaddr(req, 'loopback') 2proxyaddr(req, ['loopback', 'fc00:ac:1ab5:fff::1/64'])
loopback
: IPv4 and IPv6 loopback addresses (like ::1
and
127.0.0.1
).linklocal
: IPv4 and IPv6 link-local addresses (like
fe80::1:1:1:1
and 169.254.0.1
).uniquelocal
: IPv4 private addresses and IPv6 unique-local
addresses (like fc00:ac:1ab5:fff::1
and 192.168.0.1
).When trust
is specified as a function, it will be called for each
address to determine if it is a trusted address. The function is
given two arguments: addr
and i
, where addr
is a string of
the address to check and i
is a number that represents the distance
from the socket address.
Return all the addresses of the request, optionally stopping at the
first untrusted. This array is ordered from closest to furthest
(i.e. arr[0] === req.connection.remoteAddress
).
1proxyaddr.all(req)
The optional trust
argument takes the same arguments as trust
does in proxyaddr(req, trust)
.
1proxyaddr.all(req, 'loopback')
Compiles argument val
into a trust
function. This function takes
the same arguments as trust
does in proxyaddr(req, trust)
and
returns a function suitable for proxyaddr(req, trust)
.
1var trust = proxyaddr.compile('loopback') 2var addr = proxyaddr(req, trust)
This function is meant to be optimized for use against every request.
It is recommend to compile a trust function up-front for the trusted
configuration and pass that to proxyaddr(req, trust)
for each request.
1$ npm test
1$ npm run-script bench
No vulnerabilities found.
Reason
update tool detected
Details
Reason
no binaries found in the repo
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
project has 6 contributing companies or organizations
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
security policy file detected
Details
Reason
8 out of 10 merged PRs checked by a CI test -- score normalized to 8
Reason
8 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 6
Reason
dependency not pinned by hash detected -- score normalized to 6
Details
Reason
Found 3/23 approved changesets -- score normalized to 1
Reason
project is not fuzzed
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-06-30T21:31:57Z
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More