Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unix socket support #9

Open
dafortune opened this issue May 22, 2017 · 2 comments
Open

Unix socket support #9

dafortune opened this issue May 22, 2017 · 2 comments

Comments

@dafortune
Copy link

dafortune commented May 22, 2017

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!

@dougwilson
Copy link
Contributor

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.

@theneva
Copy link

theneva commented Jun 1, 2021

Hi! 👋 I believe this issue was fixed in the 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants