Douglas Wilson
Douglas Wilson
Weird, I have not seen the port being included on Azure before. It's unfortunate that `x-forwarded-for` is not a standard in anyway, and is up to specify by any software....
Unfortunately that `url.parse` trick seems to fail for the most basic IPv6 test case: ``` node -e 'var ip = "::1", url = require("url"); console.dir(url.parse(`http://{ip}`).hostname)' '' ```
So what we can probably do is the following: 1. If `net.isIPv6(ip) === true`, then return `ip` 2. If `ip.lastIndexOf(':') === -1` then return `ip` 3. `ip = ip.substr(0, ip.lastIndexOf(':'))`...
The `X-Forwarded-For` parsing is already extracted into a module that only does that: https://github.com/jshttp/forwarded
@fl0w you asked: > wouldn't it be sane to extract X-Forwarded-For as a separate - "replaceable" - function/repo? And I was just pointing out there is already a separate repo....
@fl0w > Allow user space to modify as needed? You already can: Use Object.defineProperty to replace the getter at app.request.ips after you create your app object to whatever function you...
@jonathanong I'll try to get something today, time pending :) From the title of this, are you intending to use it to do hop counting instead of whitelisting?
Thanks @visionmedia :) Express allows for both. I'm basically working to rip out all those accessors for express into a module to use cross-project (req.secure, req.protocol, req.ip, req.ips, req.host). It...
> I just saw the official support for Forwarded in the new http 1.1 spec thing too Yea, I saw that too and it is nice that there is something...
`proxy-addr` will be split apart some more at some point, but AFAIK there isn't a reason `proxy-addr` cannot be used as-is currently in `koa`.