SOCKS5 proxy with ssh tunnel and chrome in OSX

Written by on .

This article is about ssh, socks5, proxy and chrome.

Today I learned how to debug http services with chrome in remote environment.

I needed to debug http2 services which were only available in remote environment.

Here are the commands that you need:

# Open socks5 proxy to local port 1337
# This connects to remote host using ssh into port 2222
$ ssh -D 1337 -f -C -q -N user@remote -p 2222

# Symlink chrome binary to PATH
# ( This is optional )
$ ln -s /Applications/Google\\ Chrome \

# Open chrome using the socks5 proxy in port 1337
$ chrome --proxy-server="socks5://" \
	--host-resolver-rules="MAP * , EXCLUDE localhost"

After this new chrome window opens and all requests except localhost are resolved through the remote machine.

Now you can access remote services easily from your browser.