Unix socket support
dafortune opened this issue · comments
Hi!
When using an unix socket instead of a tcp port req.connection.remoteAddress
is undefined. And forwarded
adds that undefined value to the array of forwarded IPs (https://github.com/jshttp/proxy-addr/blob/master/index.js#L57). So given that undefined is not a valid ip https://github.com/jshttp/proxy-addr/blob/master/index.js#L254 returns false
for the index 0 and so no IP is trusted.
If are you willing to accept a PR to solve this issue, I can offer to write it: for example considering undefined the loopback address or adding an special option for that case.
Thanks!
Yea, that's what I'm thinking: to maybe just consider the UNIX socket to be the loopback address. It's probably better solved in the forwarded
module, maybe. Since a TCP/IP socket in Node.js cal also return undefined
for req.connection.remoteAddress
, simply assuming that undefined
means socket is not really enough to know that for sure.
Hi! forwarded
module in 0.2.0, which was pulled into this module in 97965bd? Maybe this issue can be closed.
(For posterity, I think this commit fixed the problem: jshttp/forwarded@63a16a6)