forwarded
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
"Forwarded" is a Node.js module designed to parse the HTTP X-Forwarded-For header. This package gives detailed information about the client's connection and it’s beneficial for identifying the originating IP addresses of a client connecting to a web server through HTTP proxy or load balancer.
To use "forwarded", first install the package using npm with the command npm install forwarded
. Import the module into your application like this: var forwarded = require('forwarded')
.
You can then use it to parse the X-Forwarded-For
header from a request. Here is an example:
var forwarded = require('forwarded');
var addresses = forwarded(req);
In this code, addresses
will be an array of IP addresses from the X-Forwarded-For header. The addresses are listed in reverse order, meaning the index 0
is the address of the client's socket, while the last index is typically the end-user's IP address.
The documentation for the "forwarded" package can be found on its npm registry page at https://npmjs.org/package/forwarded and on the project's GitHub page at https://github.com/jshttp/forwarded. The readme comprises all the essential details about the installation, API usage, and testing for the package.