trustproxy

1.1.1 • Public • Published

This is an small library that solves an issue present in express, proxyaddr, forwarded and node.js itself.

The problem is that node.js set socket.remoteAddress to undefined when you use unix sockets instead of a tcp port. Forwarded returns undefined and proxyaddr thinks that this is untrusted ip even if you trust on loopback.

The current documentation of express.js states that you can configure the trust proxy setting like this doc:

app.set('trust proxy', ['loopback', 'linklocal', 'uniquelocal']);

But this doesn't work if you run your application on a unix socket.

Use this library as follows:

const trustproxy = require('trustproxy');
app.set('trust proxy', trustproxy(['loopback', 'linklocal', 'uniquelocal']));

Installation

npm i trustproxy --save

License

MIT 2016 - José F. Romaniello

Readme

Keywords

none

Package Sidebar

Install

npm i trustproxy

Weekly Downloads

0

Version

1.1.1

License

MIT

Unpacked Size

3.78 kB

Total Files

5

Last publish

Collaborators

  • jfromaniello