I set up a SOCKS proxy at port 9090 to computer B elsewhere:
ssh -D localhost:9090 user@B
and configured it in my local Google Chrome browser.
However, computer B is behind an HTTP proxy, so HTTP requests originating locally get to computer B through the SOCKS proxy but can't be addressed (terminal running ssh -D localhost:9090 user@B shows "open failed: connect failed: No route to host" when such a request is made).
I have tried:
- setting up BOTH remote HTTP proxy (behind which computer B is) and SOCKS proxy in Google Chrome,
- running ssh -D localhost:9090 user@B with environment variable http_proxy properly set,
- adding http_proxy=_proxy_address_ to the user's .bashrc on computer B;
but none worked.
Anyone knows how to configure the SOCKS proxy so as to take into account the HTTP proxy behind which computer B is? Any method which does not involve changing SSHD or global configuration at the server would be prefered.
Best Answer
You would do a lot better to "forward" the remote network's proxy server over SSH rather than using the built-in SOCKS server (which just expects a bare gateway-addressable network at the other end).
This exposes the proxy server locally, allowing you to set your browser's proxy settings to
localhost:8080
and that will tunnel over SSH to the remote proxy.And you can apply this to any remote service. You could, for example, tunnel Imgur from your server (in effect a single-host proxy):
And on a local terminal:
The Host header is required otherwise
curl
will request a non-existentlocalhost
site. You could also work around that by adding a line in/etc/hosts
, resolvingimgur.com
to127.0.0.1
... But I'm getting off-topic, you don't need any of this for your purposes.