Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request is a proposed solution for reverse proxy support. It leaves all existing functionality in place with no effect whatsoever if you are not using the new proposed option:
proxyHeader
.This fixes issue #6 and #15 and it is heavily based on PR #20.
Logic
The basic logic is to parse the first packet on an incoming connection, read the IP header information, and load balance based on the header IP. The read packet is included in the load-balancing IPC message and is unshift'ed back onto the socket.
I included a basic proxy test and testing with websocket bench seems to indicate no major issues.
There were also some minor changes regarding the options object and I added some basic logic to support different types of balancing functions.
Example Usage