Using a Socks proxy with your iPhone

I was testing ads in one of my iPhone apps but the ads didn't display. After mailing the advertising company's support it was clear that they did not deliver any ads for the country I'm currently living in. (They check the user's location through IP geo location.) So I had to virtually move to the US ;)

After having set up a forwarding SSH tunnel (acting like a SOCKS proxy) to my US-server I had somehow to enter the proxy information into my iPhone. But there is no setting in the iPhone's system preferences app for a SOCKS proxy. Just for a HTTP one. Yet you can use a SOCKS proxy. Just create a .pac file and choose in the proxy settings the "auto" option. Enter there the URL to your .pac file. (Can be a web server too - does not have to be in your local network. And you don't have to use IPs in the .pac file. Local computer names like "imac.local" will do it too.)

Here's a nice "howto": SOCKS proxy with iPhone (if this snipplet should ever get deleted click below on read more)

Oh yeah, the settings for proxies is hidden. You have to go to wifi-settings -> click on your active network and there you can enter proxy settings.


This is the original article about getting your iPhone to work with SOCKS proxies. It was stolen from http://snipplr.com/view.php?id=16563 just in case the original ever gets lost.

Let's say, perhaps, that you are already forwarding your web traffic through an SSH/SOCKS tunnel at work (for privacy reasons that have absolutely no relation to accessing blocked sites LOL!) and you would like to use that same tunnel on your iPhone/iPod Touch. This is actually pretty easy to accomplish.

 

First, you need to make sure the SOCKS tunnel on your work computer allows LAN connections so your iPhone/iPod Touch can connect to it. To do this, you simply need to add -g to your existing SSH command (something like ssh -N -g -D 1080 user@domain.com).

 

Most people think you can't connect to a SOCKS proxy from an iPhone/iPod Touch without jailbreaking it but the truth is you can. You simply have to create a Proxy Auto-Config (PAC) file, insert the function below in it (replace the x's with your IP and the y's with the port you used after the -D in your SSH command), and save it to a web accessible place with a .pac extension. If you're reading this chances are you know how to serve a file over HTTP on your work LAN, so I won't delve into that.

 

Finally, on your iPhone/iPod Touch, go to Settings > Wifi and click the blue arrow to the right of your work network, scroll to the bottom, click Auto and type in the address to your PAC file (e.g. http://192.168.xx.xx/mysupersecretproxy.pac).

 


function FindProxyForURL(url, host)
{
return "SOCKS 192.168.xx.xx:yyyy";
}

Comments on this Article