我可以像这样使用 socat
进行端口转发:
socat TCP4-LISTEN:8080 TCP4:123.456.789.12:80
在这种情况下,它完美地工作:所有
http
对 localhost:8080
的请求都将被重定向到 123.456.789.12:80
。但是如何将这种转发用于
https
-requests?更新: 我需要 Firefox 和远程服务器之间的单个
socat
进程。 socat
只是一个转发器(代理重定向器),仅此而已。像这样的东西:Firefox -> socat -> server
------------>
https
最佳答案
通常 https 服务器在端口 443 上运行,所以这可能是您的问题?
尝试使用 https 浏览 socat 到 google.com 可以正常工作,尽管有 SSL 证书警告:
socat TCP-LISTEN:8080,fork,reuseaddr TCP:google.com:443
(使用
fork
和 reuseaddr
允许多个连接和快速 ip:port 重用,但使用 beaware of the caveats )。现在您可以从浏览器访问 google 上的 https,只需转到 https://localhost:8080 .
关于https - https的socat端口转发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34791674/