relay requested port to destination for SimpleProxy #180
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.
I have a need to redirect all requests on any port of a host to a different host, and I don't think this is covered by the current URI syntax. I'm sure it can be discussed what the optimal implementation for this is, but the PR seems the easiest way to get this feature into the current implementation and URI syntax.
Say that I run a web UI program on
host.example.com
and which listens to localhost. I now want to access it in a web browser on my own machine via an ssh tunnel. If the program uses port 8088, I can do, e.g., this:However, lets say the program on host2 uses unpredictable port numbers (perhaps it dynamically opens them). I just want to map
host.example.com:<port> -> ssh to host.example.com -> localhost:<port>
for any<port>
. If I omit the port number in the destination URI above, pproxy uses the default value of 8088.This PR allows using the request port as the destination port for anything covered by SimpleProxy by specifying the destination port as
0
(traditionally used to mean "any port" when opening ports, so it seems somewhat appropriate).After merging, this PR enables the following syntax for the above example: