Skip to content

Unix socket support #9

Open
Open

Description

@dafortune

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!

Activity

  1. dougwilson commented on Jul 25, 2017

    @dougwilson
    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.

  2. theneva commented on Jun 1, 2021

    @theneva

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions