Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relay requested port to destination for SimpleProxy #180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rartino
Copy link

@rartino rartino commented Mar 14, 2024

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:

pproxy -r ssh://host.example.com/?host.example.com#login::key__httponly://localhost:8088/"

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:

pproxy -r ssh://host.example.com/?host.example.com#login::key__httponly://localhost:0/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant