You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.4 KiB

8 years ago
  1. # forwarded
  2. [![NPM Version][npm-image]][npm-url]
  3. [![NPM Downloads][downloads-image]][downloads-url]
  4. [![Node.js Version][node-version-image]][node-version-url]
  5. [![Build Status][travis-image]][travis-url]
  6. [![Test Coverage][coveralls-image]][coveralls-url]
  7. Parse HTTP X-Forwarded-For header
  8. ## Installation
  9. ```sh
  10. $ npm install forwarded
  11. ```
  12. ## API
  13. ```js
  14. var forwarded = require('forwarded')
  15. ```
  16. ### forwarded(req)
  17. ```js
  18. var addresses = forwarded(req)
  19. ```
  20. Parse the `X-Forwarded-For` header from the request. Returns an array
  21. of the addresses, including the socket address for the `req`. In reverse
  22. order (i.e. index `0` is the socket address and the last index is the
  23. furthest address, typically the end-user).
  24. ## Testing
  25. ```sh
  26. $ npm test
  27. ```
  28. ## License
  29. [MIT](LICENSE)
  30. [npm-image]: https://img.shields.io/npm/v/forwarded.svg?style=flat
  31. [npm-url]: https://npmjs.org/package/forwarded
  32. [node-version-image]: https://img.shields.io/node/v/forwarded.svg?style=flat
  33. [node-version-url]: http://nodejs.org/download/
  34. [travis-image]: https://img.shields.io/travis/jshttp/forwarded.svg?style=flat
  35. [travis-url]: https://travis-ci.org/jshttp/forwarded
  36. [coveralls-image]: https://img.shields.io/coveralls/jshttp/forwarded.svg?style=flat
  37. [coveralls-url]: https://coveralls.io/r/jshttp/forwarded?branch=master
  38. [downloads-image]: https://img.shields.io/npm/dm/forwarded.svg?style=flat
  39. [downloads-url]: https://npmjs.org/package/forwarded