I can use socat
for the port forwarding like this:
socat TCP4-LISTEN:8080 TCP4:123.456.789.12:80
In this case, it works perfectly: all http
-requests to localhost:8080
will be redirected to 123.456.789.12:80
.
But how can I use such forwarding for https
-requests?
UPDATE: I need a single socat
process between Firefox and remote server. socat
is just a forwarder (proxy redirector), nothing more. Something like this:
Firefox -> socat -> server
------------>
https
Socat is a flexible, multi-purpose relay tool. Its purpose is to establish a relationship between two data sources, where each data source can be a file, a Unix socket, UDP, TCP, or standard input.
Netcat and Socat allows you to pass simple messages between computers interactively over the network. The below setup will allow both client and server to send data to the other party.
Local SSH Port Forwarding You can forward a local port (e.g 8080) which you can then use to access the application locally as follows. The -L flag defines the port forwarded to the remote host and remote port. Adding the -N flag means do not execute a remote command, you will not get a shell in this case.
Normally https servers run on port 443, so maybe that is your issue?
Trying to browse through socat to google.com with https works, albeit with an SSL certificate warning:
socat TCP-LISTEN:8080,fork,reuseaddr TCP:google.com:443
(use fork
and reuseaddr
to allow multiple connections and fast ip:port reuse, but beaware of the caveats).
Now you can access https at google from a browser, just go to https://localhost:8080.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With