Projekt

Obecné

Profil

Stáhnout (1.6 KB) Statistiky
| Větev: | Revize:
1 3a515b92 cagy
# forwarded
2
3
[![NPM Version][npm-image]][npm-url]
4
[![NPM Downloads][downloads-image]][downloads-url]
5
[![Node.js Version][node-version-image]][node-version-url]
6
[![Build Status][travis-image]][travis-url]
7
[![Test Coverage][coveralls-image]][coveralls-url]
8
9
Parse HTTP X-Forwarded-For header
10
11
## Installation
12
13
This is a [Node.js](https://nodejs.org/en/) module available through the
14
[npm registry](https://www.npmjs.com/). Installation is done using the
15
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
16
17
```sh
18
$ npm install forwarded
19
```
20
21
## API
22
23
```js
24
var forwarded = require('forwarded')
25
```
26
27
### forwarded(req)
28
29
```js
30
var addresses = forwarded(req)
31
```
32
33
Parse the `X-Forwarded-For` header from the request. Returns an array
34
of the addresses, including the socket address for the `req`, in reverse
35
order (i.e. index `0` is the socket address and the last index is the
36
furthest address, typically the end-user).
37
38
## Testing
39
40
```sh
41
$ npm test
42
```
43
44
## License
45
46
[MIT](LICENSE)
47
48
[npm-image]: https://img.shields.io/npm/v/forwarded.svg
49
[npm-url]: https://npmjs.org/package/forwarded
50
[node-version-image]: https://img.shields.io/node/v/forwarded.svg
51
[node-version-url]: https://nodejs.org/en/download/
52
[travis-image]: https://img.shields.io/travis/jshttp/forwarded/master.svg
53
[travis-url]: https://travis-ci.org/jshttp/forwarded
54
[coveralls-image]: https://img.shields.io/coveralls/jshttp/forwarded/master.svg
55
[coveralls-url]: https://coveralls.io/r/jshttp/forwarded?branch=master
56
[downloads-image]: https://img.shields.io/npm/dm/forwarded.svg
57
[downloads-url]: https://npmjs.org/package/forwarded