So you’re getting ready to move your website. You’ve got the new hosting plan purchased, and you’ve got the files and data copied over. You set up your hosts file to point to the new host, but something doesn’t look quite right 😕

You could keep editing your hosts file and refreshing your browser to try to figure out what is different… Or you could take 5 minutes to set up a socks proxy so you can view both the new and old site in two different browsers at the same time! Here’s how to do it:


  1. Two browsers, one of which is Firefox.
  2. A server you can connect to via SSH

The server can be anything, your new host (if they allow ssh), a friend’s server, a linode server, a digital ocean droplet, etc.

Start an SSH tunnel to act as a proxy

In a terminal on your local system run:

ssh -D 1080 -N user@your-ssh-host

-D instructs ssh to do dynamic port forwarding by creating a socket on that port locally. Any port number will do, but something above 1024 is best. I went with 1080 in this example.

-N tells ssh to not run any remote commands (like bash). This is needed to have our connection just forward data.

Configure Firefox

In Firefox open Preferences. Search for proxy. In more recent versions of Firefox, it’s at the bottom of the general section. Click the proxy Settings... button to bring up the proxy connection settings dialog:

Make the changes as indicated. Select Manual proxy configuration. Add localhost to the SOCKS Host field, and 1080 to Port and select SOCKS v5. Check the box for Proxy DNS when using SOCKS v5.

Browse in Firefox

Anything you visit in Firefox will now use the DNS information from your proxy. You’d typically use the Firefox version for the original – what is soon to be the “old” site.

Set your hosts file for your other browser

Edit your hosts file and add a line with your new host IP and your domain name:

$ vi /etc/hosts

Browse in another browser

Then you can visit the “new” site in that browser to make any comparisons and do last-minute tweaks before you switch your DNS.

Leave a Reply