Skip to content

jfromaniello/trustproxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published