How to create/use a SOCKS Proxy

Quick HOWTO on creating a SOCKS proxy for web traffic. This has been useful for emulating the user experience in China, for example.

In order to do this, you need ssh access to a server that has the characteristics you are looking for. So, for example, to emulate the Chinese user experience, you need a server in China that you can ssh to.

Starting the proxy

Execute this command in a local shell:

$ ssh -N -D 10000 user@remotehost

ssh should prompt you for a password and then hang. Ctrl-C will kill the proxy.

Using the proxy

Now go to your browser and set it to point at your proxy. These screenshots were taken from Firefox 39.

Open up firefox.

Open the menu.

Go to preferences.

Select the "Advanced" menu, because we're advanced.

Select the "Network" tab.

Click on "Settings".

We've created a SOCKS proxy on localhost on port 10000. Be sure to exclude hosts that you don't want to go through the proxy. This will often make the page load much faster, but you should understand that the emulated experience may no longer be as faithful a representation of what your users would experience. On the other hand, the added latency of your proxy (two round-trips that are often all the way around the world) may mean that many of your requests wind up timing out. Sadly that is the web experience of many of our users. If you aren't sure about what to exclude or, leave this empty and be patient.

If your proxy is down, you'll see pages like this:


Bear in mind that websites you might commonly use to test your connection (like Google) are blocked in other countries, often the same ones whose network conditions we wish to simulate. Try other sites, like tudou or yandex.



When you're done with your proxy, kill the ssh command and set your connection settings back to "No proxy".