Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to set up a tunneling proxy accessible by URL--so, to access through the tunneling proxy, you'd go to and continue to browse transparently from there. I can either set up an SSH tunnel or a VPN connection that I'd like to expose. How can I set up squid (or another proxy server) to route requests through an SSH/VPN connection like this?

share|improve this question

First, Setup your ssh tunnel

ssh you@yourproxysever -L8080:localhost:8080

Leave this connection running, this assumes that your proxy server is listening on port 8080.

Second, Setup your web browser to use localhost:8080 as its proxy server

The ssh tunnel will forward packets to your proxy server over ssh.

share|improve this answer
Use ssh -fN ... to make it drop into background after connecting. – grawity Feb 28 '10 at 11:24
Ohh, good point, I hadn't used that one. – Dave Cheney Feb 28 '10 at 20:12
Awesome; thanks! How can I use this to expose that publicly? I'm not exactly clear on how I would set up a webserver to receive a request (say, on 80), forward it to the SSH tunnel, and pass the response back. – aresnick Mar 1 '10 at 15:58

Not quite clear about what you need. But if you need to route web packets over SSH via a proxy, you can use SSH in SOCKS mode (-D) and use something like Privoxy in SOCKS mode to route it. So the connection would look like this:

[browser]---[privoxy proxy]---[ssh socks]---[remote machine]---[web server]

However, if you want to route traffic to a proxy via a SSH tunnel, you can use SSH in tunnel mode (-L) to route it something like this:

[browser]---[ssh tunnel]---[proxy on remote machine]---[web server]
share|improve this answer
So what I'd like to do is something like: [browser]---[my webserver]---[ssh tunnel]---[proxy on remote machine]---[remote web server (whatever resource the user requests] – aresnick Mar 1 '10 at 16:00
To finish that comment: it's not clear to me how to do that =) – aresnick Mar 1 '10 at 16:00
In that case, your webserver would need to function as a reverse proxy with an upstream proxy configuration. You might be able to do it with some squid magic but I have a feeling that you will need to write your own server. – sybreon Mar 2 '10 at 1:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.