Closed paul-em closed 8 years ago
These headers are located at (or closer to) the application layer since they're part of the HTTP protocol. Since we're passing file descriptors from the master to workers, one would have to read some data from the socket first in the master in order to decide which worker to router it to. We'd then have to "rewind" the read data so that the worker gets it in its entirety. That'd break layering, be much less intuitive, and of course, slower.
You'd have to come up with a creative solution to this problem. :)
I believe not able to support proxy make this solution more educational than practical.
wzrdtales/socket-io-sticky-session seems to have a solution that is similar to what @elad have described.
Should a caveat be added to the document to noted that its currently not ipv6 and proxy compatible?
Right now running this cluster behind a proxy always uses ip 127.0.0.1. I did quite some research, but I couldn't find if there is a way on how to access the X-Real-IP or X-Forwarded-For header. Any ideas on how to solve that?