tjanczuk/iisnode — pull request #310 by dpolivy (2013-11-22 01:41:42+00:00)
Title: Support for X-Forwarded-For and X-Forwarded-Proto headers

This fixes https://github.com/tjanczuk/iisnode/issues/265.

The first set of changes is to add the X-Forwarded-Proto header, with a value of either http or https. This conforms to the industry convention for this header, and allows node.js apps using express.js to set 'trust proxy' to true, and have req.ip and req.protocol properly reflect those of the incoming client request.

The second change is to the existing X-Forwarded-For header. Previously, the header value included both an IP address and port. I believe the industry convention is simply to have an IP address here, and I've updated the code to use a different function to convert IP -> string, which does not include the port.

Tests have been updated to reflect the new header. I've tested locally on 64-bit, but I don't have a 32-bit machine to test out. I've done basic testing and verified the included tests pass, however I have not done any significant stress/perf testing of these changes.

Comments appreciated!