jshttp / proxy-addr

Determine address of proxied request

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Port support?

silverwind opened this issue · comments

Are you planning to add source port support to this module?

Source ports are necessary to uniquely identify users behind NATs and can be obtained from X-Forwarded-Port and friends.

There aren't any plans, but this would indicate a request for it to be added, which I can do, or you're welcome to work on a PR in the mean time :)

I'd certainly be interested in contributing. I think we have to switch to a header parser that supports ports like forwarded-for, would that be okay for you?

No, just PR into our dependency, forwarded.

Or, perhaps we can make that pluggable in here in some way.

Now that I look at forwarded, it seems pretty barebone for my purpose. I was hoping for broader support for proxy headers other than X-Forwarded-For. Do intend to keep it lean and just support one header? If that's the case, I think I'm better of creating my own parser.

Yes, I think so. There was a long discussion about just this topic and how to design it over in the forwarded module, and I'll read it when I get home and catch myself back up on what the ideas were regarding that.

I guess it makes sense to keep is lean for express if you can support 90% of the cases through a single header and I also guess most users aren't interested in logging the port. Probably best to keep my ideas out of it and create a separate module to support exotic proxies and ports.

Maybe this may appear one day here, but this issue is quite old now, and I don't have a need to work on a PR to add it, and doesn't seem like anyone so far is, either :) This can always be reopened if needed / a new issue can be created without it being a duplicate.