Repository navigation
Add support for unix domain sockets - #109
Conversation
Signed-off-by: Alec Fenichel <alec.fenichel@transnexus.com>
Tony133
left a comment
There was a problem hiding this comment.
LGTM
Could you also update the README? It currently says that the returned array includes the socket address and that index 0 is the socket address. This is no longer accurate for Unix domain sockets after this change, since no socket address is included and the returned array can be empty.
Signed-off-by: Alec Fenichel <alec.fenichel@transnexus.com>
|
This should be reverted, Fastify's CI is affected and there are issues with it
Honestly, this was not the right place for the fix. It should be in @fastify/plugins |
This reverts commit 90ece3b. Dropping a missing socket address from the result shifts every entry down by one, so @fastify/proxy-addr treats the last X-Forwarded-For entry as the socket address. Since 3.1.0, fastify's CI fails on test/trust-proxy.test.js ("trust proxy with number and null socket remoteAddress ignores forwarded headers"): request.ip is '1.1.1.1' instead of null. Reverting restores the behavior of 3.0.x and fixes fastify's CI. Signed-off-by: Gürgün Dayıoğlu <hey@gurgun.day>
If the reason the socket has no remoteAddress is because it is a unix domain socket, then what alterantive would you want to happen in this case?
Again, if unix sockets are being used, this is likely the desired behavior.
I agree the destroyed socket spoofing case is a concern but note that prior to this change when a socket was destroyed this library would return
I agree this is not the right place for this, but I also am not sure it can be fixed in just |
|
PR submitted to |
Adds support for unix domain sockets (i.e.,
req.socket.remoteAddressisundefined).Checklist
npm run test && npm run benchmark --if-presentand the Code of conduct